我的有效pom文件有问题。 我正在运行一个多模块项目。 我有一个主pom和一个基础项目pom。 我的主pom不包含maven-release-plugin依赖项, 但是基础项目pom。 我在基础项目pom中定义了插件maven-release-plugin, 带有2.5.3版本。 但是,我从主项目获得的有效pom显示了将maven release插件作为版本2.3.2中的插件。 我有依赖项:树显示,但不显示Maven版本插件。根本不可用。我无法解释。
那怎么可能是主要的有效pom向我展示了我尚未定义的版本的maven版本插件?
我的真正问题是Jenkins使用maven-release-plugin版本来构建我的发行版。但是,这会引发错误,并且我无法正确构建。 Jenkins使用第一个定义的插件版本来构建我的发行版。
mvn依赖项:resolve-plugins在版本2.3.2中未显示任何maven-release-plugin
这是我的主要pom
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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.project</groupId>
<artifactId>ROOT</artifactId>
<version>9.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>BASE</module>
</modules>
<profiles>
<!-- Arquillian WildFly managed profile -->
<profile>
<id>id</id>
<properties>
<gitname>user</gitname>
<gitpw>password</gitpw>
<project.scm.id>git</project.scm.id>
</properties>
<distributionManagement>
<repository>
<id>m1ss-nexus</id>
<name>Release Repository</name>
<url>url</url>
<uniqueVersion>true</uniqueVersion>
</repository>
<snapshotRepository>
<id>m1ss-nexus</id>
<name>Snapshots Repository</name>
<url>url</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
<scm>
<connection>scm:git:repository</connection>
<developerConnection>scm:git:repository</developerConnection>
<tag>HEAD</tag>
</scm>
这是我使用maven-release-plugin 2.3.2的有效主要pom
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>de.project</groupId>
<artifactId>ROOT</artifactId>
<version>9.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>BASE</module>
</modules>
<scm>
<connection>connection</connection>
<developerConnection>connection</developerConnection>
</scm>
<properties>
<maven.build.timestamp.format>yyyyMMdd_HHmm</maven.build.timestamp.format>
<sonar.checkstyle.filters><module name="SuppressionCommentFilter"><property name="offCommentFormat" value="CHECKSTYLE:OFF\: ([\w\|]+)" /><property name="onCommentFormat" value="CHECKSTYLE:ON\: ([\w\|]+)" /><property name="checkFormat" value="$1" /></module><module name="SuppressionFilter"><property name="file" value="${workspace}/sonar_configs/checkstyle_suppressions.xml" /></module><module name="SuppressWithNearbyCommentFilter"><property name="commentFormat" value="Suppress checkstyle (\w+)" /><property name="influenceFormat" value="1" /></module></sonar.checkstyle.filters>
<was.appsrv>C:\IBM\WebSphere\AppServer</was.appsrv>
<maindir>C:\IBM\RSA95</maindir>
<sonar.jacoco.excludes>**/*Test.*:**/*BE.*:**/*CType.*:**/*TO.*:**/*CTO.*:**/*Exception.*:**/*DT.*:**/constants/*.*:**/datatype/*.*</sonar.jacoco.excludes>
<timestamp>20180927_1336</timestamp>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<was.appsrv.plugins>C:\IBM\WebSphere\AppServer\plugins</was.appsrv.plugins>
<hibernate.version>4.2.10.Final</hibernate.version>
<version_minor>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}</version_minor>
<was.basedir>C:\IBM\WebSphere</was.basedir>
</properties>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>m1ss-nexus</id>
<url>url</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>url repo maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>url repo maven</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>C:\develop\workspace\moss\src\main\java</sourceDirectory>
<scriptSourceDirectory>C:\develop\workspace\moss\src\main\scripts</scriptSourceDirectory>
<testSourceDirectory>C:\develop\workspace\moss\src\test\java</testSourceDirectory>
<outputDirectory>C:\develop\workspace\moss\target\classes</outputDirectory>
<testOutputDirectory>C:\develop\workspace\moss\target\test-classes</testOutputDirectory>
<resources>
<resource>
<directory>C:\develop\workspace\moss\src\main\resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>C:\develop\workspace\moss\src\test\resources</directory>
</testResource>
</testResources>
<directory>C:\develop\workspace\moss\target</directory>
<finalName>ROOT-9.0.1-SNAPSHOT</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>default-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>default-install</id>
<phase>install</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<executions>
<execution>
<id>default-site</id>
<phase>site</phase>
<goals>
<goal>site</goal>
</goals>
<configuration>
<outputDirectory>C:\develop\workspace\moss\target\site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</execution>
<execution>
<id>default-deploy</id>
<phase>site-deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<outputDirectory>C:\develop\workspace\moss\target\site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</execution>
</executions>
<configuration>
<outputDirectory>C:\develop\workspace\moss\target\site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<outputDirectory>C:\develop\workspace\moss\target\site</outputDirectory>
</reporting>
<profiles>
<profile>
<id>profileid</id>
<distributionManagement>
<repository>
<id>m1ss-nexus</id>
<name>Release Repository</name>
<url>url</url>
</repository>
<snapshotRepository>
<uniqueVersion>false</uniqueVersion>
<id>m1ss-nexus</id>
<name>Snapshots Repository</name>
<url>url</url>
</snapshotRepository>
</distributionManagement>
<properties>
<project.scm.id>git</project.scm.id>
<gitname>user</gitname>
<gitpw>password</gitpw>
</properties>
</profile>
</profiles>
</project>
这是我使用maven-release-plugin 2.5.3的基础pom
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.project</groupId>
<artifactId>BASE</artifactId>
<version>9.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
<groupId>de.project</groupId>
<artifactId>ROOT</artifactId>
<version>9.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modules>
<module>core/SRV-API-BASE</module>
<module>core/SRV-IMPL-BASE</module>
<module>core/DLG-BASE</module>
<module>components/DLG-WAR</module>
<module>components/DLG-ECOM-WAR</module>
<module>core/DLG-EAR</module>
<module>core/SRV-EAR</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.8.3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.50</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.perf4j</groupId>
<artifactId>perf4j</artifactId>
<version>0.9.16</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.20</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.1.5</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.7.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.7.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.oval</groupId>
<artifactId>oval</artifactId>
<version>1.84</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.1_spec</artifactId>
<version>1.0.1.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.capgemini.psp.server</groupId>
<artifactId>psp-server-plain-api</artifactId>
<version>2.2.21-SOE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.capgemini.psp.server</groupId>
<artifactId>psp-server-plain-env</artifactId>
<version>2.2.21-SOE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.capgemini.psp.server</groupId>
<artifactId>psp-server-plain-hibernate</artifactId>
<version>2.2.21-M1SS</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.capgemini.psp.server</groupId>
<artifactId>psp-server-plain-ejb-adapter</artifactId>
<version>2.2.21-SOE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sdm.quasar</groupId>
<artifactId>QuasarComponent</artifactId>
<version>4.0.32</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.6.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.6.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.4.8</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.ws.runtime</groupId>
<artifactId>mail-impl</artifactId>
<version>8.0.0.7</version>
<scope>test</scope>
</dependency>
<!-- Provided -->
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>2.0.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.ws.prereq</groupId>
<artifactId>jsfportlet</artifactId>
<version>8.0.0.7</version>
<scope>provided</scope>
</dependency>
<!-- Dependencies aus dem Websphere-Server. Sie ersetzen WAS Server Runtime Bibliotheken -->
<dependency>
<groupId>com.ibm.javaee</groupId>
<artifactId>j2ee</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.10.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/gen/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>parse-version</id>
<phase>initialize</phase>
<goals>
<goal>parse-version</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native2ascii-maven-plugin</artifactId>
<version>1.0-beta-1</version>
<executions>
<execution>
<id>native2ascii-utf8-resources</id>
<goals>
<goal>native2ascii</goal>
</goals>
<configuration>
<encoding>ISO-8859-1</encoding>
<includes>
<include>**\/*Txt.properties</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<branchName>master-release</branchName>
<pushChanges>false</pushChanges>
<localCheckout>true</localCheckout>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.10.0</version>
<configuration>
<tag>${project.artifactId}-${project.version}</tag>
<connectionType>connection</connectionType>
<username>user</username>
<password>password</password>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</plugin>
<plugin>
<artifactId>maven-scm-plugin</artifactId>
<version>1.10.0</version>
<configuration>
<tag>${project.artifactId}-${project.version}</tag>
<connectionType>connection</connectionType>
<username>user</username>
<password>password</password>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<ajdtVersion>1.5</ajdtVersion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.10.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
答案 0 :(得分:1)
那是由于Maven超级Pom(与java.lang.Object相比,它是所有pom继承的),请参见http://maven.apache.org/ref/3.5.0/maven-model-builder/super-pom.html