When I run "mvn deploy:deploy", maven deploys 4 jar files to my internal remote repository.
They are:
[module-name]-1.jar
[module-name]-1.pom
[module-name]-1-sources.jar
[module-name]-1-tests.jar
There are actually more files, such as md5 and sha1 files, being deployed. But for simplicity, I just skip these files here.
Is there any way to exclude [module-name]-1-sources.jar from the deployment process?
One way I can think of is to use "mvn deploy:deploy-file", which allows me to pinpoint which jar to deploy. But since I have a few dozen modules to deploy, it'll be nice if I can configure the deployment file exclusion in pom.xml. Otherwise, I'll have to write a script to deploy.
Thanks,
Richard
The “maven-source” plugin is used to pack your source code and deploy along with your project. This is extremely useful, for developers who use your deployed project and also want to attach your source code for debugging.
mvn:install copies your packaged Maven module to your local repository (by default, in ~/. m2/repository ), to be accessed by other local Maven builds. mvn:deploy uploads your packaged Maven module to another (usually remote) repository, to be accessed by other, not necessarily local, Maven builds.
mvn deploy This command is used to deploy the artifact to the remote repository. The remote repository should be configured properly in the project pom. xml file distributionManagement tag. The server entries in the maven settings.
deploy:deploy is used to automatically install the artifact, its pom and the attached artifacts produced by a particular project. Most if not all of the information related to the deployment is stored in the project's pom. deploy:deploy-file is used to install a single artifact along with its pom.
As of version 2.2
of the maven-source-plugin
you can skip source generation with a config option without having to put the plugin in a profile in your parent pom:
<!-- Do not generate a source jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<skipSource>true</skipSource>
</configuration>
</plugin>
If you don't want modify your POM, you can skip sources jar creation by adding an enviroment variable to command line:
-Dsource.skip
(for maven-source-plugin up to version 2.4, see 2.4 doc)
or
-Dmaven.source.skip
(for maven-source-plugin version 3.0.0+, see 3.0.1 doc or the latest one)
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