Skip to content
Browse files

Merge branch 'release/1.3.9'

* release/1.3.9:
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release clojure-maven-plugin-1.3.9
  Updated readme version and mentioned new goals.
  Added Cosmin Stejerean to the contrib list.
  adding clojure sources and test sources to pom so they can be picked up by the source jar
  changing language to java to fix javadoc plugin
  added support for IClojure to clojure:repl
  Updated version in README
  • Loading branch information...
2 parents f71e683 + 888ea50 commit 692a083123921901a14fc3c635e7ac42526ed57f @talios committed Feb 21, 2012
View
22 README.markdown
@@ -5,6 +5,8 @@ mixed language, enterprise project.
## Available goals
+ * clojure:add-source
+ * clojure:add-test-source
* clojure:compile
* clojure:test
* clojure:test-with-junit
@@ -27,7 +29,7 @@ add a dependency on clojure:
<plugin>
<groupId>com.theoryinpractise</groupId>
<artifactId>clojure-maven-plugin</artifactId>
- <version>1.3.4-SNAPSHOT</version>
+ <version>1.3.9</version>
<extensions>true</extensions>
</plugin>
</plugins>
@@ -179,7 +181,7 @@ or by running maven with:
<td>localhost</td>
<td>The host to bind the swank server to/td>
</tr>
- </table>
+ </table>
</td>
</tr>
<tr>
@@ -205,7 +207,7 @@ or by running maven with:
<td>2113</td>
<td>The nailgun server port</td>
</tr>
- </table>
+ </table>
</td>
</tr>
<tr>
@@ -243,7 +245,19 @@ or by running maven with:
<td></td>
<td>Arguments to the clojure script(s)</td>
</tr>
- </table>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>clojure:add-source</td>
+ <td>
+ Includes clojure source directory in -sources.jar.
+ </td>
+ </tr>
+ <tr>
+ <td>clojure:add-test-source</td>
+ <td>
+ Includes clojure test source directory in -testsources.jar.
</td>
</tr>
View
6 pom.xml
@@ -5,7 +5,7 @@
<groupId>com.theoryinpractise</groupId>
<artifactId>clojure-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
- <version>1.3.9-SNAPSHOT</version>
+ <version>1.3.10-SNAPSHOT</version>
<description>Maven plugin for compiling clojure source files</description>
<url>http://github.com/talios/clojure-maven-plugin</url>
<scm>
@@ -45,6 +45,10 @@
<name>Chas Emerick</name>
<email>cemerick@snowtide.com</email>
</contributor>
+ <contributor>
+ <name>Cosmin Stejerean</name>
+ <email>cosmin@offbytwo.com</email>
+ </contributor>
</contributors>
<licenses>
<license>
View
7 src/main/java/com/theoryinpractise/clojure/AbstractClojureCompilerMojo.java
@@ -17,6 +17,7 @@
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
import org.apache.maven.toolchain.Toolchain;
import org.apache.maven.toolchain.ToolchainManager;
@@ -28,6 +29,12 @@
public abstract class AbstractClojureCompilerMojo extends AbstractMojo {
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
/**
* The current toolchain maanager instance
View
20 src/main/java/com/theoryinpractise/clojure/ClojureAddSourceMojo.java
@@ -0,0 +1,20 @@
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+
+/**
+ * Add Clojure source directories to the POM
+ *
+ * @goal add-source
+ * @phase generate-sources
+ */
+public class ClojureAddSourceMojo extends AbstractClojureCompilerMojo {
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ for (File file : this.getSourceDirectories(SourceDirectory.COMPILE)) {
+ this.project.addCompileSourceRoot(file.getAbsolutePath());
+ }
+ }
+}
View
20 src/main/java/com/theoryinpractise/clojure/ClojureAddTestSourceMojo.java
@@ -0,0 +1,20 @@
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+
+/**
+ * Add Clojure test source directories to the POM
+ *
+ * @goal add-test-source
+ * @phase generate-test-sources
+ */
+public class ClojureAddTestSourceMojo extends AbstractClojureCompilerMojo {
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ for (File file : this.getSourceDirectories(SourceDirectory.TEST)) {
+ this.project.addTestCompileSourceRoot(file.getAbsolutePath());
+ }
+ }
+}
View
15 src/main/java/com/theoryinpractise/clojure/ClojureReplMojo.java
@@ -37,11 +37,20 @@
private String replScript;
private static final Pattern JLINE = Pattern.compile("^.*/jline-[^/]+.jar$");
+ private static final Pattern ICLOJURE = Pattern.compile("^.*/iclojure(-[^/]+)?.jar$");
boolean isJLineAvailable(List<String> elements) {
+ return isPatternFoundInClasspath(elements, JLINE);
+ }
+
+ boolean isIClojureAvailable(List<String> elements) {
+ return isPatternFoundInClasspath(elements, ICLOJURE);
+ }
+
+ private boolean isPatternFoundInClasspath(List<String> elements, Pattern pattern) {
if (elements != null) {
for (String e : elements) {
- Matcher m = JLINE.matcher(e);
+ Matcher m = pattern.matcher(e);
if (m.matches())
return true;
}
@@ -54,7 +63,9 @@ public void execute() throws MojoExecutionException {
List<String> args = new ArrayList<String>();
String mainClass = "clojure.main";
- if (isJLineAvailable(classpathElements)) {
+ if (isIClojureAvailable(classpathElements)) {
+ mainClass = "com.offbytwo.iclojure.Main";
+ } else if (isJLineAvailable(classpathElements)) {
getLog().info("Enabling JLine support");
args.add("clojure.main");
mainClass = "jline.ConsoleRunner";
View
8 src/main/resources/META-INF/plexus/components.xml
@@ -20,7 +20,7 @@
<configuration>
<type>clojure</type>
<extension>jar</extension>
- <language>clojure</language>
+ <language>java</language>
<addedToClasspath>true</addedToClasspath>
</configuration>
</component>
@@ -35,12 +35,18 @@
<clean>
org.apache.maven.plugins:maven-clean-plugin:clean
</clean>
+ <generate-sources>
+ com.theoryinpractise:clojure-maven-plugin:add-source
+ </generate-sources>
<process-resources>
org.apache.maven.plugins:maven-resources-plugin:resources
</process-resources>
<compile>
org.apache.maven.plugins:maven-compiler-plugin:compile,com.theoryinpractise:clojure-maven-plugin:compile
</compile>
+ <generate-test-sources>
+ com.theoryinpractise:clojure-maven-plugin:add-test-source
+ </generate-test-sources>
<test-compile>
org.apache.maven.plugins:maven-compiler-plugin:testCompile,com.theoryinpractise:clojure-maven-plugin:testCompile
</test-compile>

0 comments on commit 692a083

Please sign in to comment.
Something went wrong with that request. Please try again.