Skip to content

Commit 3960818

Browse files
puredangerrichhickey
authored andcommitted
Create new prod build profile in Maven.
This prod build profile will produce a jar that is the same as the normal build but with some metadata elided. To build and install to your local repo, run: mvn -Pprod,omit-extra-jars install -Dmaven.test.skip=true The omit-extra-jars profile suppresses creation of the slim, sources, and javadoc jars. The prod profile passes an extra flag to the ant task that compiles Clojure code and suppresses source in the output jar. To use this jar, specify an additional classifier=prod in your build dependency. Signed-off-by: Rich Hickey <richhickey@gmail.com>
1 parent 0098d0e commit 3960818

File tree

2 files changed

+85
-1
lines changed

2 files changed

+85
-1
lines changed

build.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
<property name="clojure_jar" location="clojure-${clojure.version.label}.jar"/>
2828
<property name="clojure_noversion_jar" location="clojure.jar"/>
29+
<property name="compiler.elide-meta" value="nil"/>
2930

3031
<target name="init" depends="clean">
3132
<tstamp/>
@@ -51,6 +52,7 @@
5152
<!--<sysproperty key="clojure.compiler.elide-meta" value="[:doc :file :line :added]"/>-->
5253
<!--<sysproperty key="clojure.compiler.disable-locals-clearing" value="true"/>-->
5354
<!-- <sysproperty key="clojure.compile.warn-on-reflection" value="true"/> -->
55+
<sysproperty key="clojure.compiler.elide-meta" value="${compiler.elide-meta}"/>
5456
<sysproperty key="java.awt.headless" value="true"/>
5557
<arg value="clojure.core"/>
5658
<arg value="clojure.core.protocols"/>

pom.xml

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,5 +274,87 @@
274274
</plugins>
275275
</build>
276276
</profile>
277-
</profiles>
277+
<profile>
278+
<id>prod</id>
279+
<activation>
280+
<activeByDefault>false</activeByDefault>
281+
</activation>
282+
<build>
283+
<plugins>
284+
<plugin>
285+
<artifactId>maven-antrun-plugin</artifactId>
286+
<version>1.6</version>
287+
<executions>
288+
<execution>
289+
<id>clojure-compile</id>
290+
<phase>compile</phase>
291+
<goals>
292+
<goal>run</goal>
293+
</goals>
294+
<configuration>
295+
<target>
296+
<property name="maven.compile.classpath"
297+
refid="maven.compile.classpath" />
298+
<property name="compiler.elide-meta"
299+
value="[:doc :file :line :added]"/>
300+
<ant target="compile-clojure"/>
301+
</target>
302+
</configuration>
303+
</execution>
304+
</executions>
305+
</plugin>
306+
<plugin>
307+
<artifactId>maven-jar-plugin</artifactId>
308+
<version>2.3.1</version>
309+
<configuration>
310+
<classifier>prod</classifier>
311+
<archive>
312+
<manifest>
313+
<mainClass>clojure.main</mainClass>
314+
</manifest>
315+
</archive>
316+
<excludes><exclude>**/*.clj</exclude></excludes>
317+
</configuration>
318+
</plugin>
319+
</plugins>
320+
</build>
321+
</profile>
322+
<profile>
323+
<id>omit-extra-jars</id>
324+
<activation>
325+
<activeByDefault>false</activeByDefault>
326+
</activation>
327+
<build>
328+
<plugins>
329+
<plugin>
330+
<artifactId>maven-source-plugin</artifactId>
331+
<executions>
332+
<execution>
333+
<id>sources-jar</id>
334+
<phase>none</phase>
335+
</execution>
336+
</executions>
337+
</plugin>
338+
<plugin>
339+
<artifactId>maven-javadoc-plugin</artifactId>
340+
<executions>
341+
<execution>
342+
<id>attach-javadocs</id>
343+
<phase>none</phase>
344+
</execution>
345+
</executions>
346+
</plugin>
347+
<plugin>
348+
<artifactId>maven-assembly-plugin</artifactId>
349+
<executions>
350+
<execution>
351+
<id>clojure-slim-jar</id>
352+
<phase>none</phase>
353+
</execution>
354+
</executions>
355+
</plugin>
356+
</plugins>
357+
</build>
358+
</profile>
359+
</profiles>
278360
</project>

0 commit comments

Comments
 (0)