Created
March 16, 2012 21:29
-
-
Save pmoriarty/2052857 to your computer and use it in GitHub Desktop.
Clojure OSGi manifest creation by Maven (using AOT)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>com.theoryinpractise</groupId> | |
<artifactId>clojure-maven-plugin</artifactId> | |
<version>1.3.9</version> | |
<executions> | |
<execution> | |
<id>compile</id> | |
<phase>compile</phase> | |
<goals> | |
<goal>compile</goal> | |
</goals> | |
<configuration> | |
<!-- AOT compile to clojure-classes so we copy only project classes to target/classes | |
for manifest calculation --> | |
<outputDirectory>${project.build.directory}/clojure-classes</outputDirectory> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<artifactId>maven-resources-plugin</artifactId> | |
<version>2.4.2</version> | |
<executions> | |
<execution> | |
<id>copy-clojure-classes</id> | |
<phase>process-classes</phase> | |
<goals> | |
<goal>copy-resources</goal> | |
</goals> | |
<configuration> | |
<!-- Copy AOT'd project classes (no deps) to target/classes | |
for manifest calculation and jar creation --> | |
<outputDirectory>${project.build.outputDirectory}/com/annadaletech</outputDirectory> | |
<resources> | |
<resource> | |
<directory>${project.build.directory}/clojure-classes/com/annadaletech</directory> | |
<includes> | |
<include>**</include> | |
</includes> | |
</resource> | |
</resources> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<!-- create a manifest from class files (clojure/java/whatever) in target/classes --> | |
<plugin> | |
<groupId>org.apache.felix</groupId> | |
<artifactId>maven-bundle-plugin</artifactId> | |
<version>2.3.6</version> | |
<configuration> | |
<unpackBundle>false</unpackBundle> | |
<instructions> | |
<Bundle-Name>${project.artifactId}</Bundle-Name> | |
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName> | |
<Bundle-Description>${project.name}</Bundle-Description> | |
</instructions> | |
</configuration> | |
<executions> | |
<execution> | |
<id>build-manifest</id> | |
<goals> | |
<goal>manifest</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
<!-- post-process the manifest to add Import-Package and Export-Package declarations | |
for clojure namespaces by scanning src/main/clojure for clojure source files --> | |
<plugin> | |
<groupId>com.annadaletech</groupId> | |
<artifactId>clojure-osgi-maven-plugin</artifactId> | |
<version>0.1.2</version> | |
<configuration> | |
<manifest>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifest> | |
</configuration> | |
<executions> | |
<execution> | |
<id>check-manifest</id> | |
<goals> | |
<goal>check-manifest</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-jar-plugin</artifactId> | |
<version>2.3.1</version> | |
<configuration> | |
<!-- Add the generated manifest to the jar --> | |
<archive> | |
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | |
</archive> | |
<!-- exclude source if desired --> | |
<excludes> | |
<exclude>**/*.clj</exclude> | |
</excludes> | |
</configuration> | |
</plugin> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment