Hi : Im finding that maven deploys by default change the file name to match the version+artifact id. For example
Deploying a jar file, with artifact=A and version=V-0.1 will result in a jar file named AV-0.1.jar.
Is there a way to change the default name of the jar file in the deployment, so that it doesnt concatenate these feilds or to specify the final deployed jar name explicitly?
Maven Install Command: mvn install The mvn deploy runs the deploy plugin which deploys an artifact to the remote repository. A project may include the main jar and associated sources and Javadoc jars. The sources jar contains the Java sources, and the Javadoc jar contains the generated Javadoc.
So, the answer is yes, mvn deploy will execute install and build the project artifacts.
Once you have created your Maven repository, go to Application | Artifactory | Artifacts, select your Maven repository and click Set Me Up. In the Set Me Up dialog, click Generate Maven Settings. You can now specify the repositories you want to configure for Maven.
Complex answer to that: Yes
It is a bit tricky and you need to be careful, as the pom won't get re-written. So only the maven remote repository (artifactory, or nexus) will put it into the correct folder structure.
If you overwrite the deploy-file goal in the maven deploy goal, you can overwrite the parameters: http://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html
One example which would always post version 4.5.1 to nexus would look like this:
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>deploy-file</goal>
</goals>
<phase>deploy</phase>
<configuration>
<repositoryId>nexus-site</repositoryId>
<url>http://nexus.some.where/nexus-2/content/repositories/releases</url>
<file>${build.directory}/${project.build.finalName}.${project.packaging}</file>
<generatePom>false</generatePom>
<pomFile>pom.xml</pomFile>
<version>4.5.1</version>
</configuration>
</execution>
</executions>
</plugin>
(and before someone asks, one reason to do something like this is to make builds more CI friendly. in CI everything is just a build number, there is not really a "build a release", every checkin does yield a production-ready artifact. So by replacing 4.5.1 with ${BUILD_NUMBER}
will leave you with many many releases in your artifact storage ...)
Simple answer to that is: No.
The problem behind it is if you would change the naming schema it will not be possible to find artifacts in a repository. That's the reason having a fixed naming schema.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With