Java 确定maven部署文件的存储库URL
我正在使用Maven构建一个特定的项目,在POM中,我正在使用Maven shade插件构建主要工件的3个不同变体(我正在创建uber JAR,其中包含各种日志框架组合)。shade插件创建具有替代工件ID的JAR及其各自的依赖性降低POM 我现在面临的挑战是如何将这些新构件部署到远程存储库。我使用maven安装插件将它们安装到我的本地repo中,但是maven部署插件需要显式配置存储库URL。我希望插件采用默认部署使用的远程repo,无论是快照还是发布repo,还是通过命令行传入的另一个repo URL。我希望找到一些maven属性,比如${project.remoterepo.url},它等同于已解析的repo。当部署目标已经这样做时,显式地配置远程URL似乎很愚蠢Java 确定maven部署文件的存储库URL,java,maven,maven-shade-plugin,maven-deploy-plugin,Java,Maven,Maven Shade Plugin,Maven Deploy Plugin,我正在使用Maven构建一个特定的项目,在POM中,我正在使用Maven shade插件构建主要工件的3个不同变体(我正在创建uber JAR,其中包含各种日志框架组合)。shade插件创建具有替代工件ID的JAR及其各自的依赖性降低POM 我现在面临的挑战是如何将这些新构件部署到远程存储库。我使用maven安装插件将它们安装到我的本地repo中,但是maven部署插件需要显式配置存储库URL。我希望插件采用默认部署使用的远程repo,无论是快照还是发布repo,还是通过命令行传入的另一个rep
谢谢你的建议。谢谢 这就是我根据版本模式自动选择SNAPSHOT或RELEASE Repo所做的:(我知道这是一种代码味道,但ASF不愿意包含您的代码,因为我可以解决我的需求)
.. url发布回购。。
.. id释放回购。。
.. 快照回购。。
.. id快照repo。。
org.codehaus.mojo
构建助手maven插件
3.0.0
使用了构建帮助器正则表达式
验证
正则表达式属性
isSnapshot
${project.version}
.*-快照
真的
假的
org.codehaus.gmaven
gmaven插件
1.5
验证
执行
...
org.apache.maven.plugins
maven部署插件
3.0.0-M1
真的
部署到艺术工厂
部署
部署文件
${deploy.Url}
${deploy.Id}
target/${project.build.finalName}.${project.packaging}
${project.groupId}
${project.artifactId}
${project.version}
罐子
资源
${project.build.directory}/pom/pom.xml
你知道怎么做吗?我在部署时遇到了同样的问题:部署文件开始激怒我了。不,而且maven kings非常没有同情心。您只能按照他们的命令使用这些工具!改变你的业务以适应这个工具基本上就是我被告知的
<properties>
<deploy.repositoryUrl>.. url release repo ..</deploy.repositoryUrl>
<deploy.repositoryId>.. id release repo ..</deploy.repositoryId>
<deploy.repositorySnapshotUrl>.. snapshot repo ..</deploy.repositorySnapshotUrl>
<deploy.repositorySnapshotId>.. id snapshot repo ..</deploy.repositorySnapshotId>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<!-- sets the isSnapshot property to true if SNAPSHOT was used -->
<id>build-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>isSnapshot</name>
<value>${project.version}</value>
<regex>.*-SNAPSHOT</regex>
<replacement>true</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<!-- set the properties deploy.Url and deploy.Id during validation to
either the snapshot repository or the release repository
depending on the version pattern.-->
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source><![CDATA[
pom.properties['deploy.Url']=pom.properties['isSnapshot'].equals('true') ? pom.properties['deploy.repositorySnapshotUrl'] : pom.properties['deploy.repositoryUrl'];
pom.properties['deploy.Id']=pom.properties['isSnapshot'].equals('true') ? pom.properties['deploy.repositorySnapshotId'] : pom.properties['deploy.repositoryId'];
]]></source>
</configuration>
</execution>
</executions>
</plugin>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>DeployToArtifactory</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<url>${deploy.Url}</url>
<repositoryId>${deploy.Id}</repositoryId>
<file>target/${project.build.finalName}.${project.packaging}</file>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<classifier>resources</classifier>
<pomFile>${project.build.directory}/pom/pom.xml</pomFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>