简体   繁体   中英

Maven artifact version number in jar file

I am using Maven 3 for build xxx-common module

After building my application i get my jar file as 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

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 "

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

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

Still it pushes as 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 .

You can define it at the outputFileNameMapping config option for you project.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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