maven conditional dependencies
Asked Answered
F

1

9

We would like to bundle library dependencies from (Alfresco or Jackrabbit or ...) based on the customer choice. The number of dependencies actually varies based on the chosen vendor. How do we provide hooks at the maven level, so that the final product just includes the dependent jars as per customer selection.

Forsworn answered 9/3, 2010 at 11:44 Comment(0)
N
21

You could achieve this by putting the needed dependencies into vendor-specific profiles in your pom:

<profiles>
    <profile>
        <id>Alfresco</id>
        <dependencies>
            ...
        </dependencies>
    </profile>
    <profile>
        <id>Jackrabbit</id>
        <dependencies>
            ...
        </dependencies>
    </profile>
</profiles>

Then you can activate the desired profile for your build like:

mvn -PJackrabbit install
Newby answered 9/3, 2010 at 11:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.