I'm having some trouble articulating this question so I will try my best to abstract away as much irrelevant detail as possible. If more detail is required please ask.
I have a project containing a pom which contains a dependency which is always downloaded and unziped into a directory when a user does a mvn clean install on that pom. However I would like to forego the downloading and unpacking of that dependency when a user passes in a property such as mvn clean install -Dcontent=false but does everything else in that pom.
For a lack of a better way of saying this, I'd like to know how to make a certain dependency optional in maven? Not optional in the sense described here: http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html
but optional at build time as described above.
Edit:
Build Step
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>unpack</id>
<phase>compile</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.company.random</groupId>
<artifactId>content</artifactId>
<version>${contentVersion}</version>
<type>zip</type>
<outputDirectory>contentdir/target</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugins>
</build>
@Mikita Currently this will always execute, how could I make this to execute only when -Dcontent=true