Maven: Prevent default-jar loading - only loading jar-with-dependencies

I value Maven 3 at work. For a few sample projects, I have to deploy them to the server (without a repository), but this is not a problem.

In my current project example, I am trying to load only "jar-with-dependencies". and this is exactly the problem.

Everything works fine, except that the main artifact and jar-with-dependencies (created by the plug-in assembly) are loaded.

How to prevent Maven, or rather the deployment phase, from loading the main jar and downloading only the given or specified file (in this case, the assembly file is "jar-with-dependencies")?

Turning to the question Create only executable jar-with-dependencies in Maven , I cannot just change the packaging setting to pom, because it will also prevent the collector plugin from adding my classes to the JAR file. It creates only a JAR file with dependency files.

I hope I am clear about my problem and you can help me;)

+4
source share
2 answers

If you just look at how to add a file for deployment, you can look here:

http://mojo.codehaus.org/build-helper-maven-plugin/attach-artifact-mojo.html

Maybe this helps. If you do not state your needs in more detail.

0
source

There seems to be no way to configure the deployment plugin to filter some artifacts from the project and selectively deploy others. Faced with a similar problem, we solved it with ease-maven-plugin . It fits well with our release process, but may not be the best choice for everyone, as it provides a two-step approach. During the build, you must make a list of all artifacts and filter out the ones you want to deploy. In the second step, you run mvn deploy in a separate project (or a separate profile), in which the list of artifacts is attached to the project as the only artifacts that are then deployed. See the examples in the maven plugin source code for a better understanding of how this works.

The original version cannot filter out specific project artifacts. I forked the project and added fixes that add this.

0
source

All Articles