is there a way where i can pass a command switch to change my dependencies?
meaning, i have
<dependency>
<groupId>api</groupId>
<artifactId>api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
and set it up in such a way where if i do
mvn package -Dprovided
my effective POM would be
<dependency>
<groupId>nmsc</groupId>
<artifactId>nmsc_api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>provided</scope>
</dependency>
without using profiles as profiles require me to put the dependencies in twice. is this possible?
Using profiles doesn’t require you to list the dependencies multiple times if you pair it with variables, though if you’re just doing that for a single property, then maybe you should just override a property directly:
Then you should be able to override the scope of the specified dependencies:
Note, I haven’t compiled this, so if there are typos please correct them and note the correction.