M2eclipse: Maven dependencies as JARs not projects

I have a maven project on Eclipse with the m2eclipse plugin. This project has some dependencies. Some of them are slf4j, apache-commons, etc. But there are also my libraries that I develop at the same time in eclipse. Unfortunately, m2eclipse creates the build path so that my libraries are added to the class path not as JAR archives from the M2 repository, but as class files from the /target/classes directory. For this reason, I cannot use maven-shade-plugin beacuse. I get a message:

" Error creating shaded jar: error in opening zip file /home/user/workspace/my-project/project-a/target/classes ".

When I build project-a from the command line using mvn clean install , everything works fine - a shaded JAR is generated. How to fix it?

+4
source share
1 answer

After hours of searching, I already found a solution. This can be done by configuring the Maven Build configuration 1. Select the arrow in the Run As .. menu 2. Select Run Configurations ... 3. Select your Maven Builder project 4. On the right tab (Home tab) uncheck : "Allow workspace artifacts."

Click "Apply" and create a project - everything will work as you wish :).

+4
source

Source: https://habr.com/ru/post/1300977/


All Articles