Hi Nikki,

have a look at the maven-flatten-plugin at https://www.mojohaus.org/flatten-maven-plugin/

This essentially allows you to use your parent POMs during builds but deletes the reference to them when your artifact gets deployed, integrating the information from the parents at the appropriate places (flattening), reducing the information "leaked" to the consumer of your artifact to the bare minimum.

Cheers,
Wolf

On 19.12.18 08:53, Nikki Novak wrote:
https://github.com/BattlePlugins/BattleArena

Got a report on Discord that one of the users could not build one of our open 
source projects: BattleArena.

Examples of his error reproduced by me (with an empty local-repo):
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:03 min
[INFO] Finished at: 2018-12-18T20:38:53-06:00
[INFO] Final Memory: 14M/390M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project BattleArena:
Could not resolve dependencies for project mc.alk:BattleArena:jar:3.9.10.21:
Failed to collect dependencies at mc.euro:BukkitInterface:jar:4.0.1:
Failed to read artifact descriptor for mc.euro:BukkitInterface:jar:4.0.1:
Could not find artifact mc.euro:BukkitInterface-Parent:pom:parent in 
rainbowcraft-repo (http://rainbowcraft.sytes.net/maven/repository/) -> [Help 1]
[ERROR]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:06 min
[INFO] Finished at: 2018-12-18T20:35:57-06:00
[INFO] Final Memory: 12M/392M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project BattleArena:
Could not resolve dependencies for project mc.alk:BattleArena:jar:3.9.10.22:
Failed to collect dependencies at mc.alk:BattleBukkitLib:jar:4.0.2:
Failed to read artifact descriptor for mc.alk:BattleBukkitLib:jar:4.0.2:
Could not find artifact mc.alk:BattleBukkitLib-parent:pom:parent in 
rainbowcraft-repo (http://rainbowcraft.sytes.net/maven/repository/) -> [Help 1]
[ERROR]

Maven is looking for the Parent POM of multi-module projects.
BattleArena has THREE of these multi-module projects as dependencies:
https://github.com/Europia79/BukkitInterface
https://github.com/BattlePlugins/BattleBukkitLib
https://github.com/BattlePlugins/WorldEditUtil

And our Maven repository:
http://rainbowcraft.sytes.net/maven/repository/

So, I am thinking that these multi-module projects are mis-configured ?
Because when I deploy them, I am only deploying the final JAR of the main 
module (for example):
mvn deploy -pl modules/BukkitInterface

Hack#1:
Obviously, I can just deploy ALL modules & call it a day...
But these other modules don't have life-cycles...
Meaning that they're not used at all... except to create the final JAR.

Hack#2:
For these multi-module projects, I have since learned that the modules must be 
set to optional.
And I've discovered that deleting the Parent block from the main-module's 
pom.xml fixes the issue.
And Maven will no longer look for the Parent-POM.

But this really seems like a hach-ish solution:  Not best practices.
Because as I understand it:  The Parent-block just denotes inheritance.

I would really like to figure this out & understand it.
What is Maven best practices here ?

How does one configure these libraries (multi-modules) in such a way that 
dependent projects aren't un-necessarily looking for the Parent-POMs ?
(When they should be happy with just the libraries JAR file).




--
"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, 
mais quand il n'y a plus rien à retrancher."
- Antoine de Saint-Exupéry, Terre des Hommes


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to