Permalink
Browse files

Merge pull request #46 from cosmin/develop

adding clojure sources and test sources to pom
  • Loading branch information...
2 parents 25cbda0 + feaff33 commit df0c152bd33af9dbb0bed5419ca7d4208f6076bf @talios talios committed Feb 21, 2012
@@ -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
@@ -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());
+ }
+ }
+}
@@ -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());
+ }
+ }
+}
@@ -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 df0c152

Please sign in to comment.