From: <jbo...@li...> - 2005-12-20 15:45:22
|
Author: rl...@jb... Date: 2005-12-20 10:45:01 -0500 (Tue, 20 Dec 2005) New Revision: 1888 Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-addSources-plugin/src/main/java/org/jboss/mojo/plugins/sources/ trunk/labs/jbossbuild/projects/maven-plugins/maven-addSources-plugin/src/main/java/org/jboss/mojo/plugins/sources/AdditionalSourcesMojo.java Log: initial entry Added: trunk/labs/jbossbuild/projects/maven-plugins/maven-addSources-plugin/src/main/java/org/jboss/mojo/plugins/sources/AdditionalSourcesMojo.java =================================================================== --- trunk/labs/jbossbuild/projects/maven-plugins/maven-addSources-plugin/src/main/java/org/jboss/mojo/plugins/sources/AdditionalSourcesMojo.java 2005-12-20 15:44:58 UTC (rev 1887) +++ trunk/labs/jbossbuild/projects/maven-plugins/maven-addSources-plugin/src/main/java/org/jboss/mojo/plugins/sources/AdditionalSourcesMojo.java 2005-12-20 15:45:01 UTC (rev 1888) @@ -0,0 +1,70 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + **/ +package org.jboss.mojo.plugins.sources; + +import java.io.File; +import java.util.Iterator; +import java.util.List; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; + +/** + * @goal addsources + * @phase generate-sources + * @description Goal which lets a user add additional source directories to the + * project + * @author rue...@jb... + * @version $Id: AdditionalSources.java + */ +public class AdditionalSourcesMojo extends AbstractMojo { + + /** + * The maven project + * @parameter expression="${project}" + * @required + */ + private MavenProject project; + + /** + * A list of source directories to include in compilation. + * + * @parameter + */ + private List additionalDirs; + + public void execute() throws MojoExecutionException, MojoFailureException { + + if ((additionalDirs != null) && (project != null)) { + for (Iterator it = additionalDirs.iterator(); it.hasNext();) { + File addDir = new File((String) it.next()); + this.getLog().info("Adding additional compilation root: " + addDir.getAbsolutePath()); + project.addCompileSourceRoot(addDir.getAbsolutePath()); + } + + } + + } + +} |