M
M
mresc2013-06-02 19:02:30
Java
mresc, 2013-06-02 19:02:30

Excluding dependencies from maven build depending on client/user

There is a project going from several modules using maven. Modules are implementations of certain functionality.

How to exclude certain modules from dependencies when building for different clients (users)?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
D
dvayanu, 2013-06-02
@dvayanu

profiles?

D
dvayanu, 2013-06-02
@dvayanu

You can add everything to the profile, including dependencies:
pom.xml:
<profiles> <profile> <id>profile1</id> <dependencies> <dependency> <groupId>xxx</groupId> <artifactId>yyy</artifactId> </dependency>
And so on. You make one profile default, for convenience. When building -Pprofile1 and that's it.
maven.apache.org/guides/introduction/introduction-to-profiles.html

S
Sergey Sidorov, 2013-06-03
@ISergius

As already mentioned, you can set specific dependencies in profiles. Profiles can be set directly for the project in the pom, through settings.xml (globally or for a specific user), and in the profiles.xml profile descriptor.
There is a section in settings.xml

<activeProfiles>
    <activeProfile>profile-name</activeProfile>
</activeProfiles>

where you can pass, for example, the variable ${user.name}

M
martingussa, 2019-11-28
@martingussa

The blog was absolutely fantastic ! Lot of great information which can be helpful in some or the other way. Keep updating the blog, looking forward for more contents...Great job, keep it up

R
rakeshshukla, 2019-12-12
@rakeshshukla

Its wonderful, looking at the time and effort you put into your weblog and detailed information you provide. I'll bookmark your weblog and visit it weekly for your new posts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question