gpt4 book ai didi

maven - 无法使 buildnumber-maven-plugin 插件工作

转载 作者:行者123 更新时间:2023-12-02 21:59:32 24 4
gpt4 key购买 nike

无论我做什么,我都无法在项目的最终名称中获取 buildNumber :(请求Maven高手看看并提出一些解决方案。

这是我的 pom.xml

<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>
<groupId>in.techieme.springmaven</groupId>
<artifactId>SimpleProject</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>SimpleProject Maven Webapp</name>
<url>http://maven.apache.org</url>


<properties>
<spring.version>3.1.1.RELEASE</spring.version>
<jdk.version>1.6</jdk.version>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
<configuration>



<useLastCommittedRevision>true</useLastCommittedRevision>
</configuration>
</execution>
<execution>
<id>generate-timestamp</id>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
<configuration>
<format>{0,date,yyyy-MM-dd}</format>
<items>
<item>timestamp</item>
</items>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<target>${jdk.version}</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>

</plugins>
</pluginManagement>
<finalName>${artifactId}-${buildRevision}-${buildDateTime}-${buildNumber}</finalName>
</build>

<scm>
<connection>scm:svn:http://localhost/project1/{project.artifactId}</connection>
<developerConnection>scm:svn:http://localhost/project1/{project.artifactId}</developerConnection>
<tag>HEAD</tag>
<url>http://localhost/project1/{project.artifactId}</url>
</scm>

提前致谢。

最佳答案

finalName 仅适用于 target 文件夹中 Artifact 的名称,而不适用于将部署到存储库的 Artifact 。

您遇到的简单问题是您在pluginManagement中定义了buildnumber-maven-plugin,而不是在构建区域中:

将以下内容添加到您的 pom 文件中:

<project>
<build>
<pluginManagement>
...
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
</plugin>
</plugins>
...
</build>
</project>

您需要真正执行 buildnumber 插件,但情况并非如此。

关于maven - 无法使 buildnumber-maven-plugin 插件工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17190657/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com