Permalink
Browse files

Revert "Revert "tracks multiple source dirs inside maven configuratio…

…n with new goal addsource""

This reverts commit 2e51de5.
  • Loading branch information...
1 parent 2e51de5 commit e21f06296417f49157b9d015817eac770720a9f3 @franckbonin franckbonin committed Jun 13, 2012
Showing with 68 additions and 0 deletions.
  1. +68 −0 src/main/java/org/codehaus/mojo/AddSourceMojo.java
View
68 src/main/java/org/codehaus/mojo/AddSourceMojo.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2011, Neticoa SAS France - Tous droits réservés.
+ * Author(s) : Franck Bonin, Neticoa SAS France
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.codehaus.mojo;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Add more source directories to the POM.
+ *
+ * @goal addsource
+ * @phase initialize
+ * @author Franck Bonin
+ * @version $Id$
+ * @since 0.0.5
+ * @threadSafe
+ */
+public class AddSourceMojo extends AbstractMojo
+{
+ /**
+ * directory were sources are
+ *
+ * @parameter
+ * @since 0.0.4
+ */
+ private List sourceDirs = new ArrayList();
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ * @since 0.0.5
+ */
+ private MavenProject project;
+
+ public void execute()
+ {
+ getLog().info( "Cxx Maven Plugin AddSource " );
+ Iterator it = sourceDirs.iterator();
+ while(it.hasNext())
+ {
+ File source = new File( (String) it.next() );
+ this.project.addCompileSourceRoot( source.getAbsolutePath() );
+ getLog().info( "Source directory: \"" + source.getAbsolutePath() + "\" added to Maven Project." );
+ }
+ }
+}
+

0 comments on commit e21f062

Please sign in to comment.