From dfedaa374d0eed3fa2549d05bd460083804577cf Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 10 Jan 2014 14:58:58 +0000
Subject: [PATCH] Move manifest concatenation to Maven plugin.
---
opendj-config-maven-plugin/src/main/java/org/forgerock/opendj/maven/OpendjConfigMojo.java | 38 +++++++++++++++++++
opendj-config/pom.xml | 57 ++++++++++++++++------------
2 files changed, 71 insertions(+), 24 deletions(-)
diff --git a/opendj-config-maven-plugin/src/main/java/org/forgerock/opendj/maven/OpendjConfigMojo.java b/opendj-config-maven-plugin/src/main/java/org/forgerock/opendj/maven/OpendjConfigMojo.java
index c4c4e81..12e8809 100644
--- a/opendj-config-maven-plugin/src/main/java/org/forgerock/opendj/maven/OpendjConfigMojo.java
+++ b/opendj-config-maven-plugin/src/main/java/org/forgerock/opendj/maven/OpendjConfigMojo.java
@@ -99,6 +99,18 @@
private String generatedManifestsTempDir;
/**
+ * Temporary directory containing generated manifests.
+ * <p>
+ * There is one manifest file generated by component. It is the
+ * responsibility of project that use this plugin to concatenate all
+ * generated files into a single file.
+ *
+ * @parameter default-value="${project.build.directory}/admin/core.manifest"
+ * @required
+ */
+ private String generatedManifestsLocation;
+
+ /**
* Root directory containing generated messages for configuration.
*
* @parameter default-value="${basedir}/src/main/resources/config/messages"
@@ -233,6 +245,9 @@
getLog().info("Generate I18N messages and profiles...");
exec.generateMessagesAndProfiles();
+
+ getLog().info("Adding source directory " + generatedSourcesRootDir);
+ getProject().addCompileSourceRoot(generatedSourcesRootDir);
}
void checkDirectories() throws MojoExecutionException {
@@ -293,6 +308,29 @@
transformationSetForManifests()
)),
executionEnvironment(getProject(), getSession(), getPluginManager()));
+
+ /*
+ * Concatenate all single manifest files to a single manifest for
+ * core administration components.
+ */
+ executeMojo(
+ plugin(
+ groupId("org.apache.maven.plugins"),
+ artifactId("maven-antrun-plugin"),
+ version("1.7")),
+ goal("run"),
+ configuration(
+ element(name("target"),
+ element(name("concat"),
+ attribute("destfile", generatedManifestsLocation),
+ element(name("fileset"),
+ attributes(
+ attribute("dir", generatedManifestsTempDir),
+ attribute("includes", "**/*.manifest")))),
+ element(name("delete"), attribute("dir", generatedManifestsTempDir))
+ )
+ ),
+ executionEnvironment(getProject(), getSession(), getPluginManager()));
}
/**
diff --git a/opendj-config/pom.xml b/opendj-config/pom.xml
index bd917d4..0e79bfe 100644
--- a/opendj-config/pom.xml
+++ b/opendj-config/pom.xml
@@ -99,7 +99,6 @@
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/java</source>
- <source>${project.build.directory}/generated-sources/config</source>
</sources>
</configuration>
</execution>
@@ -195,34 +194,44 @@
</execution>
</executions>
</plugin>
- <!-- Concatenate all single manifest files to a single manifest for
- core administration components. -->
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>prepare-package</phase>
- <configuration>
- <target>
- <concat
- destfile="${project.build.outputDirectory}/admin/core.manifest">
- <fileset dir="${project.build.directory}/tmp"
- includes="**/*.manifest" />
- </concat>
- <delete dir="${project.build.directory}/tmp" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only.
+ It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.forgerock.opendj</groupId>
+ <artifactId>opendj-config-maven-plugin</artifactId>
+ <versionRange>[3.0.0-SNAPSHOT,)</versionRange>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>true</runOnIncremental>
+ <runOnConfiguration>true</runOnConfiguration>
+ </execute>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
<reporting>
<plugins>
--
Gitblit v1.10.0