Java Maven release插件使用构建版本命名文件

Java Maven release插件使用构建版本命名文件,java,maven,Java,Maven,当我执行maven发行版时:perform生成的文件的名称具有构建版本的含义:artifactId.version。 我需要至少在执行perform时生成的war的名称将只是artifactId名称 my pom is here: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:

当我执行maven发行版时:perform生成的文件的名称具有构建版本的含义:artifactId.version。 我需要至少在执行perform时生成的war的名称将只是artifactId名称

my pom is here:

<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>me.tingz</groupId>
  <artifactId>dashboard</artifactId>
  <packaging>war</packaging>
  <version>15-SNAPSHOT</version>
  <name>dashboard Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <distributionManagement>
        <repository>
            <id>google</id>
            <url>file:/home/ziv/Documents/dashboard/versions/</url>
        </repository>
    </distributionManagement>



  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>

    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongo-java-driver</artifactId>
        <version>3.0.4</version>
    </dependency>
    <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1</version>
        </dependency>
  </dependencies>
  <build>

       <finalName>dashboard</finalName>
        <plugins>

        <!-- Release plugin Test!!!! -->
        <plugin>

            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.2</version>
            <configuration>

                <tagBase>
                    file:/home/ziv/tag
                </tagBase>
                 <checkModificationExcludes>
            <checkModificationExclude>pom.xml</checkModificationExclude>
        </checkModificationExcludes>
            </configuration>
        </plugin>

        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-scm-plugin</artifactId>
        <version>1.9.4</version>
        <configuration>
          <username>zivziv</username>

        </configuration>
      </plugin>

        <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>

  </build>
  <dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1</version>
        </dependency>
    </dependencies>
  </dependencyManagement>
  <scm>
        <connection>xxx</connection>
        <developerConnection>xxxd</developerConnection>
      <tag>dashboard-11</tag>

  </scm>
</project>
我的pom在这里:
4.0.0
梅丁兹
仪表板
战争
15-快照
仪表板Maven Webapp
http://maven.apache.org
谷歌
文件:/home/ziv/Documents/dashboard/versions/
朱尼特
朱尼特
3.8.1
测试
javax.servlet
servlet api
2.5
org.mongodb
mongo java驱动程序
3.0.4
com.googlecode.json-simple
简单json
1.1
仪表板
maven发布插件
2.5.2
文件:/home/ziv/tag
pom.xml
org.apache.maven.plugins
maven scm插件
1.9.4
齐夫齐夫
maven编译器插件
2.4
1.8
1.8
com.googlecode.json-simple
简单json
1.1
xxx
xxxd
仪表板-11

Maven发布插件不会“生成”任何文件。Maven构建生命周期中涉及的其他插件,例如jar插件,会生成文件。因此,只要涉及到“生成”,就应该像您那样设置“最终名称”

发布插件的作用是

  • 在SCM中标记代码
  • 将工件部署到存储库
后者总是需要一个Maven GAV,而V代表的是版本。否则,发布将不是唯一的。因此,如果您希望发布插件将工件部署到存储库中,但名称中没有版本,那么您将失败。根据定义,这是不可能的

你应该考虑根本不使用发布插件——毕竟,它是一个蹩脚的插件。见例


考虑使用VangMaven插件来实现您的目标:

文件url看起来像
file:///home/...
…谢谢。你知道为什么生成的文件名总是与版本一致吗?非常感谢你的回答,我意识到将maven用于发布是不好的。顺便说一句,每次给war文件不同的名称并不明智,因为web应用程序的上下文路径基于war名称…@zivziv77您确定没有混淆发布版本吗?发行版必须具有某种唯一标识符,最好将其放在工件的名称中。当然,对于用于web服务器部署的程序集,可以删除WAR文件的版本信息。请参阅Maven的汇编插件。此外,您还可以通过其他方式设置web应用程序的上下文名称,例如使用META-INF/context.xml。