With this approach we intend to define a set of artifacts by their version. The POM is typically stored in a version control systems. To download dependencies the artifacts are specified explicitly. Since version 0.8.0 the artifacts can be defined within the configuration of the plugin. Code Block Placeholder |
---|
code-language | HTML and XML |
---|
code-title | pluginManagement in pom.xml |
---|
| <build>
...
<pluginManagement>
<plugins>
...
<plugin>
<groupId>de.smartics.maven.plugin</groupId>
<artifactId>apptools-maven-plugin</artifactId>
<version>0.8.0<<version>${project.version}</version>
<configuration>
<artifacts>
<gav>com.example.project:my-artifact-one:obr:${version.my-artifact-one}</gav>
...
<gav>com.example.project:my-artifact-last:${version.my-artifact-last}</gav>
</artifacts>
</configuration>
</plugin>
</plugins>
</pluginManagement>
...
</build> |
Prior versions needed to have the artifacts source folder filled by the Maven Dependency Plugin like this: Code Block |
---|
language | xml |
---|
title | plugins in build of pom.xml |
---|
| <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${version.maven-dependency-plugin}</version>
<executions>
<execution>
<id>copy</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.example.project</groupId>
<artifactId>my-artifact-one</artifactId>
<version>${version.my-artifact-one}</version>
<type>obr</type>
</artifactItem>
...
<artifactItem>
<groupId>com.example.project</groupId>
<artifactId>my-artifact-last</artifactId>
<version>${version.my-artifact-last}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/apps</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</plugin> |
Then specify the versions as properties in profiles. This way the declaration of the versions is more concise and you may have different sets of versions, e.g. for releases and snapshots. Code Block |
---|
language | xml |
---|
title | profiles in pom.xml |
---|
| <profile>
<id>snapshots</id>
<properties>
<version.my-artifact-one>1.6.2-SNAPSHOT</version.my-artifact-one>
...
<version.my-artifact-last>1.3.0-SNAPSHOT</version.my-artifact-last>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>de.smartics.maven.plugin</groupId>
<artifactId>apptools-maven-plugin</artifactId>
<configuration>
<allowSnapshots>true<<requireReleases>false</allowSnapshots>requireReleases>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<id>releases</id>
<properties>
<version.my-artifact-one>1.6.0</version.my-artifact-one>
...
<version.my-artifact-last>1.2.0</version.my-artifact-last>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>de.smartics.maven.plugin</groupId>
<artifactId>apptools-maven-plugin</artifactId>
<configuration>
<allowSnapshots>false<<requireReleases>true</allowSnapshots>requireReleases>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
|
|