标签: maven-deploy-plugin

Maven嵌入式部署不使用org.apache.httpcomponents.httpclient 4.4版

在我的应用程序中,我必须(mvn)以编程方式部署工件.我是在maven-embedder工件和一些非常简单的代码的帮助下完成的:

MavenCli client = new MavenCli();
int result = client.doMain(new String[] { "deploy" }, "C:/some/path/to/my/pom", System.out, System.out);
Run Code Online (Sandbox Code Playgroud)

为了能够做到这一点,我不得不将以下依赖项添加到我的pom:

<dependency>
  <groupId>org.apache.maven</groupId>
  <artifactId>maven-embedder</artifactId>
  <version>3.2.5</version>
</dependency>
<dependency>
  <groupId>org.eclipse.aether</groupId>
  <artifactId>aether-connector-basic</artifactId>
  <version>1.0.2.v20150114</version>
</dependency>
<dependency>
  <groupId>org.eclipse.aether</groupId>
  <artifactId>aether-transport-wagon</artifactId>
  <version>1.0.2.v20150114</version>
</dependency>
<dependency>
  <groupId>org.apache.maven.wagon</groupId>
  <artifactId>wagon-http</artifactId>
  <version>2.8</version>
</dependency>
<dependency>
  <groupId>org.apache.maven.wagon</groupId>
  <artifactId>wagon-provider-api</artifactId>
  <version>2.8</version>
</dependency>
<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpclient</artifactId>
  <version>4.3</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

问题是,当我将httpclient的版本更改为4.4版(最新版本)时,尝试部署时出现以下错误:

4840 [main] WARN Sisu  - Error injecting:   org.apache.maven.wagon.providers.http.HttpWagon
    java.lang.NoClassDefFoundError: org/apache/http/ssl/TrustStrategy
    at java.lang.ClassLoader.defineClass1(Native Method)
    ...
Caused by: java.lang.ClassNotFoundException:   org.apache.http.ssl.TrustStrategy
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)   
    ... 72 more
Run Code Online (Sandbox Code Playgroud)

任何人都有一个想法,为什么部署在org.apache.httpcomponents.httpclient的4.3.x版本上工作正常并且在版本4.4中失败?

maven maven-embedder maven-deploy-plugin apache-httpclient-4.x

3
推荐指数
1
解决办法
4631
查看次数

Jenkins:调用 Maven 部署时日志过多

jenkins日志中,调用maven plugin maven-deploy-plugin:2.8.2:deploy时日志过多。

例如,当我尝试将 50MB 的 war 上传到 Nexus 时,有:

Uploading: ...
2/51018 KB
4/51018 KB
6/51018 KB
...
25412/51018 KB
...
51018/51018 KB
Uploaded: ...
Run Code Online (Sandbox Code Playgroud)

每 2 KB 有一行,在这个例子中有 51018/2 = 25509 行!

如何将 jenkins(或 maven)配置为只有上传状态,如:

Uploading: ...
51018/51018 KB
Uploaded: ...
Run Code Online (Sandbox Code Playgroud)

java maven maven-deploy-plugin jenkins

3
推荐指数
1
解决办法
322
查看次数

如何编译所有模块但只安装/部署选定的模块?

我有一个典型的多模块maven项目.

  • 有一个Jenkins工作,它构建并将所有快照部署到内部存储库.
  • 还有另一个Jenkins构建,它可以检查代码,更新所有pom版本,以及构建和部署版本化工件.

我想通过仅部署所需要的伪影,以优化后者:这是23100+模块.

构建仍应编译并测试所有模块,但仅将选定的模块工件安装/部署到内部存储库.

问题:有办法吗?

pom.xml maven-3 maven maven-deploy-plugin jenkins

3
推荐指数
1
解决办法
1579
查看次数

在 Maven POM 中禁用 distributionManagement

我试图mvn deploy在我的 Liferay portlet 上使用 maven运行一个目标,但出现以下错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.
2:deploy (default-deploy) on project MyPortlet: Deployment failed: repository eleme
nt was not specified in the POM inside distributionManagement element or in -Dal
tDeploymentRepository=id::layout::url parameter -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on pro
ject RiskID: Deployment failed: repository element was not specified in the POM
inside distributionManagement element or in -DaltDeploymentRepository=id::layout
Run Code Online (Sandbox Code Playgroud)

我知道如果您不在<distributionManagement />pom.xml 中包含该标记,则会返回此错误,但是我不希望将其打包到远程位置,而是希望部署到我的本地 tomcat 实例;这个可以配置吗?

java tomcat liferay maven maven-deploy-plugin

3
推荐指数
1
解决办法
7204
查看次数

如何控制Maven工件的Group/Artifact/Version坐标?

在我的Maven构建结束时,为此明确目的而存在的一个模块从各种其他模块收集工件,并使用Assembly插件将它们压缩到存档中.完成后,它使用Deploy插件将它们部署到Nexus.

由于历史原因,此包装模块被调用bundle,因此工件最终被调用,因此mygroup:bundle被归类为Nexus.

我宁愿让它们显示在下面mygroup:myprojectname,但我无法弄清楚如何将它们部署到该位置.我已经尝试配置Deploy插件的deploy-file目标来更改坐标,但没有成功.作为一个额外的复杂功能,项目的主代码模块已被调用myprojectname,因此该组在部署时不为空.但是,由于分类器和类型,不需要覆盖任何内容.

没有重命名模块,我能以某种方式这样做吗?

deployment maven maven-assembly-plugin maven-deploy-plugin

2
推荐指数
1
解决办法
2694
查看次数

如何沉默maven嘈杂的上传日志

我在maven中看到很多上传日志,例如:

114/970 KB   
116/970 KB   
118/970 KB   
120/970 KB   
122/970 KB   
124/970 KB   
126/970 KB 
Run Code Online (Sandbox Code Playgroud)

其中大多数似乎都是从maven-deploy-plugin生成的,同时将jar上传到nexus存储库.

有没有办法让他们沉默?不依赖于maven之外的工具,比如grep.

使用我们的并行构建系统会严重污染我们的日志,并且很难在没有其他工具的情况下分析它们.

我已经阅读:http: //maven.apache.org/plugins/maven-deploy-plugin/ 但找不到任何有用的选项.

maven maven-deploy-plugin

1
推荐指数
1
解决办法
776
查看次数

如何防止部署 Maven 创建的 ZIP 文件?

我使用 maven-dependency-plugin 收集应用程序的所有依赖项,然后使用 maven-assemble-plugin 将它们打包在 ZIP 文件中。这部分工作一切都很好。

但是,当我这样做时mvn deploy,它会将 ZIP 文件部署到我的 Archiva 服务器,这是我不想要的。我只想将 JAR 单独部署在那里。

有什么办法可以阻止 ZIP 文件的上传吗?

以下是我的 POM 的相关部分:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
    <execution>
      <phase>package</phase>
      <goals>
        <goal>copy-dependencies</goal>
      </goals>
      <configuration>
        <outputDirectory>${project.build.directory}/lib</outputDirectory>
      </configuration>
    </execution>
  </executions>
</plugin>

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-assembly-plugin</artifactId>
  <version>2.3</version>
  <executions>
    <execution>
      <id>make-assembly</id>
      <phase>package</phase>
      <goals>
        <goal>single</goal>
      </goals>
      <configuration>
        <finalName>myProject-${project.version}</finalName>
        <outputDirectory>../</outputDirectory>
        <descriptors>
          <descriptor>src/main/assembly/assembly.xml</descriptor>
        </descriptors>
      </configuration>
    </execution>
  </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

java maven maven-assembly-plugin maven-deploy-plugin

1
推荐指数
1
解决办法
1165
查看次数

maven 添加 zip 文件以部署到远程服务器

我有 Maven 项目。当我在文件夹中单击安装maven 构建zipjar文件时target

但是当我单击部署时,它只会将jar文件和依赖项部署到远程存储库。

问题:如何使用标准 maven 插件添加 zip 文件以部署到远程 nexus 存储库。

编辑

<packaging>custom-zip<packaging>

java zip maven-3 maven maven-deploy-plugin

1
推荐指数
1
解决办法
3645
查看次数

maven通过命令行将test.jar部署到nexus

我正在使用以下命令将旧工件上传到新的关系,因为它们无法重建。

mvn deploy:deploy-file 
  --settings=~/.m2/settings_att_nexus.xml 
  -DgroupId=com.org 
  -Dsources=someone-3.3.1-SNAPSHOT-sources.jar 
  -Djavadoc=someone-3.3.1-SNAPSHOT-javadoc.jar 
  -Dtestjar=someone-3.3.1-SNAPSHOT-tests.jar
  -DpomFile=someone-3.3.1-SNAPSHOT.pom 
  -DartifactId=someone 
  -Dversion=3.3.1-SNAPSHOT 
  -DgeneratePom=false -Dpackaging=jar 
  -DrepositoryId=snapshots 
  -Durl=http://someurl:8076/nexus/content/repositories/snapshots 
  -Dfile=someone-3.3.1-SNAPSHOT.jar
Run Code Online (Sandbox Code Playgroud)

所有必需的jar都已成功上传,但是someone-3.3.1-SNAPSHOT-tests.jar并未进入nexus,后者作为参数传递给带有以下标记的上述命令:

-Dtestjar=someone-3.3.1-SNAPSHOT-tests.jar
Run Code Online (Sandbox Code Playgroud)

有人可以一口气告诉Maven部署到test.jar上的正确标签是什么。

nexus maven maven-deploy-plugin

1
推荐指数
1
解决办法
1757
查看次数

Artifactory Maven 示例失败并显示 401 错误代码

我正在我的本地主机上尝试 Artifactory。尽管我已经按照他们的教程 来做他们的 Maven 示例,但我还是失败了 401 状态代码。这是我得到的错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project multi: Failed to deploy artifacts: Could not transfer artifact org.jfrog.test:multi:pom:3.7-20190117.083916-1 from/to snapshots (http://localhost:8081/artifactory/libs-snapshot-local): Failed to transfer file http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi/3.7-SNAPSHOT/multi-3.7-20190117.083916-1.pom with status code 401 -> [Help 1]

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project multi: Failed to deploy artifacts: Could not transfer artifact org.jfrog.test:multi:pom:3.7-20190117.083916-1 from/to snapshots (http://localhost:8081/artifactory/libs-snapshot-local): Failed to transfer file http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi/3.7-SNAPSHOT/multi-3.7-20190117.083916-1.pom with status code 401
Run Code Online (Sandbox Code Playgroud)

这是位于 /Users/my_user_name/.m2 中的 settings.xml 的内容:

<?xml …
Run Code Online (Sandbox Code Playgroud)

artifactory maven maven-deploy-plugin

1
推荐指数
1
解决办法
2014
查看次数

Maven突然抛出错误,Truncated类文件

昨天Maven工作正常,今天它显示问题,我试过备份它也不起作用,并为您的信息tomcat工作正常它的maven问题,我卸载maven并重新安装它和所有事情发布此问题之前

{Stack trace: 
    -----------------------------------------------------------------------
    Exception in thread "main" java.lang.ClassFormatError: Truncated class file
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:30)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:588)
        at sun.reflect.annotation.AnnotationParser.annotationForMap(AnnotationParser.java:239)
        at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:229)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
        at java.lang.reflect.Field.declaredAnnotations(Field.java:1016)
        at java.lang.reflect.Field.getAnnotation(Field.java:1000)
        at com.google.inject.spi.InjectionPoint.getAtInject(InjectionPoint.java:468)
        at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:653)
        at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:358)
        at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:377)
        at com.google.inject.internal.BindingBuilder.toProvider(BindingBuilder.java:106)
        at com.google.inject.internal.BindingBuilder.toProvider(BindingBuilder.java:43)
        at org.sonatype.guice.plexus.binders.PlexusTypeBinder.hear(PlexusTypeBinder.java:85)
        at org.sonatype.guice.plexus.binders.PlexusXmlBeanModule.configure(PlexusXmlBeanModule.java:91)
        at org.sonatype.guice.plexus.binders.PlexusBindingModule.configure(PlexusBindingModule.java:62)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229)
        at com.google.inject.spi.Elements.getElements(Elements.java:103)
        at com.google.inject.spi.Elements.getElements(Elements.java:80)
        at org.sonatype.guice.bean.binders.MergedModule.configure(MergedModule.java:54)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229)
        at com.google.inject.spi.Elements.getElements(Elements.java:103)
        at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:136)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
        at com.google.inject.Guice.createInjector(Guice.java:94)
        at com.google.inject.Guice.createInjector(Guice.java:71)
        at com.google.inject.Guice.createInjector(Guice.java:61)
        at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:470)
        at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:196)
        at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:160)
        at org.apache.maven.cli.MavenCli.container(MavenCli.java:375) …
Run Code Online (Sandbox Code Playgroud)

java eclipse maven maven-deploy-plugin

0
推荐指数
1
解决办法
7532
查看次数