给定这个完整的Maven POM文件,该文件用作打包(JAR,WAR等)项目的根POM或仍应使用新版本标记标记的非打包项目(例如网页)。 ..
<?xml version="1.0" encoding="ISO-8859-1"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>Common Maven parent POM</name>
<description>Maven parent POM for common POM properties for any type of project</description>
<url>http://my.site.com</url>
<groupId>com.my.site</groupId>
<artifactId>mvn-common</artifactId>
<version>0.12-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<eclipse.projectName>${project.name} ${project.version}</eclipse.projectName>
<mvn.local.repo.root>file:///C:/.m2</mvn.local.repo.root>
<scm.url.root>https://localhost/svn</scm.url.root>
<scm.url.project>workspace/tools/maven/pom/mvn-common</scm.url.project>
<scm.url.trunk>scm:svn:${scm.url.root}/${scm.url.project}/trunk</scm.url.trunk>
<scm.url.tag>${scm.url.root}/${scm.url.project}/tags</scm.url.tag>
<!-- Deploy makes only sense to packaged artifacts -->
<skip.deploy>true</skip.deploy>
</properties>
<scm><developerConnection>${scm.url.trunk}</developerConnection></scm>
<distributionManagement>
<repository>
<id>mvn.repo.releases</id>
<url>${mvn.local.repo.root}/releases</url>
</repository>
<snapshotRepository>
<id>mvn.repo.snapshots</id>
<url>${mvn.local.repo.root}/snapshots</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<!-- These must also be defined in the local settings as <servers> -->
<repository>
<id>mvn.repo</id>
<url>${mvn.local.repo.root}/repo</url>
</repository>
<repository>
<id>mvn.repo.releases</id>
<url>${mvn.local.repo.root}/releases</url>
</repository>
<repository>
<id>mvn.repo.snapshots</id>
<url>${mvn.local.repo.root}/snapshots</url>
</repository>
</repositories>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<skip>${skip.deploy}</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<projectNameTemplate>${eclipse.projectName}</projectNameTemplate>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<tagBase>${scm.url.tag}</tagBase>
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>2.5</version>
</extension>
</extensions>
</build>
</project>
...执行
时,我无法在命令行上覆盖属性truemvn release:prepare && mvn -Dskip.deploy=false release:perform
该属性用于设置maven-deploy-plugin的配置值以跳过部署为默认值(应该在子POM中为打包的项目覆盖)并且我认为应该可以覆盖用户定义的像这样的属性,但不是Maven属性,在这种情况下是maven.deploy.skip。
该版本工作正常,因为它在SVN存储库中正确创建了一个新的标记版本的POM但我无法让maven-deploy-plugin识别命令行上属性集的值
[INFO] [INFO] --- maven-deploy-plugin:2.8.1:deploy (default-deploy) @ mvn-common ---
[INFO] [INFO] Skipping artifact deployment
[INFO] [INFO] ------------------------------------------------------------------------
我在这里俯瞰什么吗?这里的某个错误可能是一个解释,但我没有发现任何报告适用于我搜索时。如果有人能够看到任何看起来不正确的东西或者给我提示接下来要尝试什么,那就太好了。
答案 0 :(得分:3)
我最终在Properties lost during Maven release:perform中找到了答案,答案解释说有一个分叉的发布过程,以便识别命令行属性并让它覆盖POM中设置的属性必须通过通过作为
-Darguments=-D...
然后我必须使用的命令看起来像这样
mvn release:prepare && mvn release:perform -Darguments=-Dskip.deploy=false
感谢我自己回答这个问题并感谢Stephen Connolly回答了另一个问题。很遗憾,直到知道我试图谷歌的所有噪音时才找到答案。