ricardoespsanto
ricardoespsanto

Reputation: 1110

share property among dependencies

Is it possible to share a property between two dependencies?

This is my layout:

PARENT (can't change this)
    - proj A (Can't change this either - has a lot of properties)
        - proj B (Need to specify which version of proj A I will use when compiling this)

so I changed it to become:

PARENT
    - proj A
    - proj B (no longer a son of proj A and now importing proj A as dependency of scope import type pom)

The problem is that I have now lost proj A's properties that I need to access in project B!

Can you see a solution for this?

Thank you in advance.

Upvotes: 0

Views: 32

Answers (1)

Guillaume Darmont
Guillaume Darmont

Reputation: 5018

The only way to share properties is using inheritance. Since you can't change PARENT, the solution is to create an intermediate parent pom for proj A and proj B.

The resulting layout would be :

PARENT
    COMMON_PROPERTIES_PARENT (with properties used by proj A and proj B)
        - proj A
        - proj B (no longer a son of proj A and now importing proj A as dependency of scope import type pom)

Upvotes: 1

Related Questions