Maven là 3.1.0.Plugin phiên bản Maven-plugin Maven 2.2
Tôi đang sử dụng plugin-maven-plugin: 2.2 trong tệp pom.xml của dự án của tôi (như được hiển thị bên dưới). Ngoài cấu hình tập tin pom.xml thường lệ, tôi chỉ hiển thị ảnh chụp mã chính dưới đây:
<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>
<artifactId>tools-parent</artifactId>
<version>0.0.7-SNAPSHOT</version>
<packaging>pom</packaging>
<description>
Infrastructure related to the "vapp" and
"deployer" utilities.
</description>
<parent>
<groupId>com.company.product</groupId>
<artifactId>deploy-parent</artifactId>
<version>0.0.6-SNAPSHOT</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.9.4</version>
<configuration>
<connectionType>connection</connectionType>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<!-- Make sure that only non-snapshot versions are used for the dependencies. Only active when property 'snapshotDependencyAllowed' is false. -->
<id>enforce-no-snapshots</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<skip>${snapshotDependencyAllowed}</skip>
<rules>
<requireReleaseDeps>
<message>No Snapshots Allowed!</message>
</requireReleaseDeps>
<requireReleaseVersion>
<message>No Snapshots Allowed!</message>
</requireReleaseVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Bây giờ, khi tôi chạy: mvn clean install, nó được xây dựng thành công.
LƯU Ý: Trong dự án của tôi, tôi có phần cha, nơi tôi phụ thuộc vào tạo tác cha mẹ triển khai có id nhóm "com.company.product" là id nhóm tôi muốn công cụ-cha mẹ tạo tác (có pom.xml tôi đã dán ở trên) nhưng triển khai-cha mẹ là một tạo tác của kho/dự án khác.
Khi tôi chạy: phiên bản mvn: set -DnewVersion = 0.0.7, tôi nhận được thông báo lỗi sau.
[INFO] ------------------------------------------------------------------------
[INFO] Building tools-parent 0.0.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:set (default-cli) @ tools-parent ---
[INFO] Searching for local aggregator root...
[INFO] Local aggregation root: /user/home/u100123/giga/tools
[INFO] Processing change of com.company.product:tools-parent:0.0.7-SNAPSHOT -> 0.0.7
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] tools-parent .................................... FAILURE [1.093s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.404s
[INFO] Finished at: Fri May 01 20:44:22 GMT-00:00 2015
[INFO] Final Memory: 12M/246M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.2:set (default-cli) on project tools-parent: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.2:set failed. NullPointerException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
BÂY GIỜ, khi tôi thay đổi phiên bản phiên bản-maven-plugin trở lại 2.1 (mà những gì tôi đã sử dụng trước đó), trên các phiên bản mvn: set -DnewVersion = 0.0.7 lệnh đang làm việc thành công và Tệp pom.xml được thay đổi thành công thành <version>0.0.7</version>
để tạo thành công cụ gốc.
Với phiên bản 2.2, nó cho tôi lỗi và không thay đổi phiên bản thành 0.0.7.
- Bất kỳ lý do nào khiến lỗi 2.2 không thành công? Có thể làm gì để giải quyết nó?
Điều quan trọng nhất ở đây là thông báo chính thức chưa được đưa ra ... – khmarbaise
Hm .. cảm ơn bạn đã chia sẻ. –