0

I'm somewhat new to using Maven projects in Netbeans, but I really like it. The only thing that seems kind of a pain is actually deploying to a an executable jar with the dependencies.

I've added various plugins to my POM file, including maven-jar-plugin & maven-shade-plugin, which enhance and fully automate the jar build process. I also have the project set to package on Clean & Build. The real problem is that apparently the shade plugin breaks Netbeans's ability to run projects among other things. This can be fixed... by removing the shade plugin, but this switching on and off by editing code in the POM is moderately frustrating and an ineffective use of time.

Is there a way where I can build an executable jar file with the dependencies for testing the program outside the IDE environment on every Clean & Build without breaking the Maven Project in the IDE? Preferable a plugin that doesn't break the Netbeans IDE in the same way as shade.

When the final artifact jar contains classes not originating in current project, NetBeans internal compiler cannot use the sources of the project for compilation. Then changes done in project's source code only appears in depending projects when project is recompiled. Also applies to features like Refactoring which will not be able to find usages in depending projects.

Warning

Sarah Szabo
  • 10,345
  • 9
  • 37
  • 60
  • I recommend having a look at the intellij IDEA, if you still want to use Netbeans, you could define profiles in your pom, with shade bound to different maven lifecycle phases (e.g. `none`) – sschrass Apr 21 '18 at 15:54
  • You state _"the shade plugin breaks Netbeans's ability to run projects"_, but provide no further information. Can you explain in more detail? Is it literally all projects that can't be run in NetBeans? What happens when you try to run another project? How exactly does the the shade plugin _"break the Netbeans IDE"_? – skomisa Apr 21 '18 at 16:12
  • @skomisa I'll update the question with the exact Netbeans response. – Sarah Szabo Apr 21 '18 at 16:16
  • I think it is a duplicate. I flagged it as such so that other users have a different path to the correct answer. – Sarah Szabo Apr 21 '18 at 17:04

0 Answers0