简体   繁体   English

jar文件中的Maven工件版本号

[英]Maven artifact version number in jar file

I am using Maven 3 for build xxx-common module 我正在使用Maven 3构建xxx通用模块

After building my application i get my jar file as xxx-common-0.0.1.jar 构建我的应用程序后,我将我的jar文件获取为xxx-common-0.0.1.jar。

this is getting deployed into my artifactory as 这被部署到我的工件中

http://localhost:8800/artifactory/core-release/com/xxx/xxx-common/0.0.1/xxx-common-0.0.1.jar HTTP://本地主机:8800 / artifactory的/核心释放/ COM / XXX / XXX-普通/ 0.0.1 / XXX-共0.0.1.jar

That deployment is good, 部署很好,

Here, how can I eliminate version number getting appended " xxx-common-0.0.1.jar " and need it just as " xxx-common.jar " 在这里,我该如何消除附加了“ xxx-common-0.0.1.jar ”的版本号,并像“ xxx-common.jar ”一样使用它

Kindly help out to overcome this problem guys... 请帮助克服这个问题的家伙...


Sorry it didn't worked out 抱歉,没有解决

Below is what i gave.... 以下是我给的。。。

<plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <finalName>${project.artifactId}</finalName>
                </configuration>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin> 

        </plugins>

executed using 使用执行

mvn package mvn包

and

Installing /home/xxx/build-deploy-tools/.jenkins/jobs/workspace/xxx-common/target/xxx-common.jar to /home/xxx/.m2/repository/com/xxx/xxx-common/0.0.1/xxx-common-0.0.1.jar 将/home/xxx/build-deploy-tools/.jenkins/jobs/workspace/xxx-common/target/xxx-common.jar安装到/home/xxx/.m2/repository/com/xxx/xxx-common/0.0 0.1 / XXX-共0.0.1.jar

Still it pushes as xxx-common-0.0.1.jar 仍然将其推送为xxx-common-0.0.1.jar

In your repository, you cannot ever get rid of the numbers. 在您的存储库中,您永远无法摆脱数字。 In your target directory, you can use a finalName element in the configuration of the Maven JAR Plugin . 在目标目录中,可以在Maven JAR插件的配置中使用finalName元素。

You can define it at the outputFileNameMapping config option for you project. 您可以在项目的outputFileNameMapping config选项中定义它。

This option defaults to 此选项默认为

${module.artifactId}-${module.version}${dashClassifier?}.${module.extension}

So, in your case, you could change it to 因此,您可以将其更改为

${module.artifactId}.${module.extension}

Reference: http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html 参考: http : //maven.apache.org/plugins/maven-assembly-plugin/assembly.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM