Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

 

Shows how to use the Apptools Maven Plugin in a separate POM project.

Basic Configuration

Simply add the configuration to the POM file of your project.

pluginManagement in pom.xml
<build>
  ...
  <pluginManagement>
    <plugins>
      ...
      <plugin>
        <groupId>de.smartics.maven.plugin</groupId>
        <artifactId>apptools-maven-plugin</artifactId>
        <version>0.12.0</version>
      </plugin>
    </plugins>
  </pluginManagement>
  ...
</build>

You may specify default includes and excludes or impose a processing order with order.

Configure Apps

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.

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.

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</allowSnapshots>
            </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</allowSnapshots>
            </configuration>
          </plugin>
        </plugins>
      </pluginManagement>
    </build>
  </profile>
</profiles>
  • No labels