Maven global plugin configuration
Asked Answered
C

1

11

I'd like to have a plugin configuration that will not exist inside the pom.xml file (and also in any project files).

What I want to do is to have a plugin that will be used only by me on my workstation. Specifically, I want to deploy my project onto the Tomcat 7 container and for this I want to use Apache Tomcat Maven Plugin, but since different developers may want to use different servers or entire ways of deployment I don't want to put this configuration into the pom.xml.

Is it possible in Maven to have such global/user-specific plugin configuration?

Cruller answered 24/9, 2014 at 8:57 Comment(1)
You can configure a specific profile in the "settings.xml" located in the /conf folder of your maven installation.Rabbit
L
0

There are several workarounds that I can think of.

  • in the pom.xml a specific set for where you define your way of deployment.

    ex: mvn goal -P{PROFILE_NAME}

  • you can just put the plugin normally in pom.xml and just don't push the changes on the repository, so it won't be available for other developers.

But the assumption seems kind of wrong, if you many developers want to work on the same project they should use the same container for deployment for persistence or if you really want to do it like this, I think the cleanest way would be for every developer to use maven profiles. And in your local settings.xml (USER_HOME/.m2/settings.xml) just set the profile as default:

(...)
<activeProfiles>
        <activeProfile>{YOUR_USER_PROFILE}</activeProfile>
</activeProfiles>
(...)

so you don't need to always specify at command line when running mvn your user profile.

Linguini answered 23/10, 2020 at 11:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.