Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Here's an example assembly descriptor (which can be packaged into the shared build-scripts artifact as below):

Code Block
xmlxml
titleassembly/includes.xml
xml
<assembly>
  <id>include</id>
  <formats>
    <format>zip</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
    <fileSet>
      <directory>src/main/native/include</directory>
      <outputDirectory>include</outputDirectory>
    </fileSet>
    <fileSet>
      <directory>target/classes/META-INF/lib</directory>
      <outputDirectory>lib</outputDirectory>
    </fileSet>
  </fileSets>
</assembly>

And a pom snippet to use it (which can be factored out to a common parent pom):

Code Block
xmlxml
titlelib/pom-part.xml
xml
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>build-includes</id>
            <phase>package</phase>
            <goals>
              <goal>attached</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>assembly/includes.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>

...

Now we need to make the build for the application project unpack the includes zip, before trying to compile the native code. We can use the dependencies plugin for this:

Code Block
xmlxml
titleapp/pom.xml
xml
<dependencies>
   <dependency>
      <!-- for example... -->
      <groupId>com.wapmx.maven2.nativeexample</groupId>
      <artifactId>nativeexample-lib-${mx.sysinfo}</artifactId>
      <version>1.1</version>
      <type>zip</type>
      <classifier>include</classifier>
   </dependency>
</dependencies>

<build>
   <plugins>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-dependencies</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/extracted</outputDirectory>
              <includeTypes>zip</includeTypes>
              <includeClassifiers>include</includeClassifiers>
            </configuration>
          </execution>
        </executions>
      </plugin>
   </plugins>
</build>

...