【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>
- In My project I have different modules.
- Each module have pom.xml in which packaging is a jar.
- And each pom refer to common parent.
-
In parent module there is also a pom.xml which includes all the modules.
But when i tried to make the packaging in the pom.xml of parent module it shows the error that is "Packaging jar is invalid Aggregator project need pom as packaging".
I want to make the executable jar of the application from maven so,what is the solution for this problem or is there is any other solution.
解决方法:
To make things short: if your parent-aggregator project don't contains source code (and it's a good practice), just add this to your parent pom.xml:
<packaging>pom</packaging>
If the parent project contains source code, I strongly suggest you to:
- move this code in a new module (let's call it
commons
) - make
commons
a child module of your parent project - add the
commons
module as a dependency of all other modules requiring it (maybe all of them) - add
<packaging>pom</packaging>
in the parent pom.xml
来源:oschina
链接:https://my.oschina.net/u/2000675/blog/2250735