Example usage for org.apache.maven.project MavenProject addCompileSourceRoot

List of usage examples for org.apache.maven.project MavenProject addCompileSourceRoot

Introduction

In this page you can find the example usage for org.apache.maven.project MavenProject addCompileSourceRoot.

Prototype

public void addCompileSourceRoot(String path) 

Source Link

Usage

From source file:org.bsc.maven.plugin.processor.MainAnnotationProcessorMojo.java

License:Open Source License

@Override
protected void addCompileSourceRoot(MavenProject project, String dir) {
    project.addCompileSourceRoot(dir);
}

From source file:org.codehaus.mojo.gwt.AbstractGwtMojoTestCase.java

License:Apache License

/**
 * //from ww w.j av  a  2s  .c  o m
 * @param pDir path to the pomDirectory, relative to the baseDir of this project
 * @return the GwtMojo corresponding with the goal
 * @throws Exception
 */
protected ArtifactResolver newMojo(String pDir) throws Exception {
    File testRoot = new File(getBasedir(), pDir);
    ArtifactResolver vm = (ArtifactResolver) lookupMojo(getGoal(), new File(testRoot, "pom.xml"));

    MavenProject project = new MavenProjectStub();
    //addCompileSourceRoot will generate singletonList if null, which doesn't support a second add.
    setVariableValueToObject(project, "compileSourceRoots", new ArrayList<String>());
    project.addCompileSourceRoot(new File(testRoot, "src/main/java").getAbsolutePath());

    //required field of mojo
    setVariableValueToObject(vm, "project", project);

    return vm;
}

From source file:org.codehaus.mojo.jaxb2.XjcMojo.java

License:Apache License

@Override
protected void addCompileSourceRoot(MavenProject project) {
    project.addCompileSourceRoot(getOutputDirectory().getAbsolutePath());
}

From source file:org.codehaus.mojo.templating.FilterSourcesMojo.java

License:Apache License

@Override
protected void addSourceFolderToProject(MavenProject mavenProject) {
    mavenProject.addCompileSourceRoot(getOutputDirectory().getAbsolutePath());
}

From source file:org.codehaus.mojo.xmlbeans.CompileXmlBeansMojo.java

License:Apache License

protected void updateProject(MavenProject project, SchemaCompiler.Parameters compilerParams, boolean stale)
        throws DependencyResolutionRequiredException, XmlBeansException {
    if (getLog().isDebugEnabled()) {
        getLog().debug("Adding " + compilerParams.getSrcDir().getAbsolutePath()
                + " to the project's compile sources.");
    }//  w w  w.  j a v a2 s .  c o  m
    project.addCompileSourceRoot(compilerParams.getSrcDir().getAbsolutePath());
    Resource resource = new Resource();
    resource.setDirectory(compilerParams.getClassesDir().getAbsolutePath());
    resource.setFiltering(false);
    project.addResource(resource);
}

From source file:org.eclipse.tycho.core.osgitools.OsgiBundleProject.java

License:Open Source License

private void addPDESourceRoots(MavenProject project) {
    EclipsePluginProjectImpl eclipsePluginProject = getEclipsePluginProject(
            DefaultReactorProject.adapt(project));
    for (BuildOutputJar outputJar : eclipsePluginProject.getOutputJars()) {
        for (File sourceFolder : outputJar.getSourceFolders()) {
            removeDuplicateTestCompileRoot(sourceFolder, project.getTestCompileSourceRoots());
            project.addCompileSourceRoot(sourceFolder.getAbsolutePath());
        }//from w w w.  jav  a2  s  .  c  o  m
    }
}

From source file:org.jannocessor.maven.plugin.MainJAnnocessorProcessMojo.java

License:LGPL

protected void addCompileSourceRoot(MavenProject project, String dir) {
    project.addCompileSourceRoot(dir);
}

From source file:org.neuro4j.compiler.N4j2JavaMojo.java

License:Apache License

protected void addCompileSourceRoot(MavenProject project) {
    project.addCompileSourceRoot(getOutputDirectory().getAbsolutePath());
}

From source file:org.onos.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl.java

License:Open Source License

private static void setOutputBaseDirAsSourceFolder(final File outputBaseDir, final MavenProject mavenProject) {
    Preconditions.checkNotNull(mavenProject, "Maven project needs to be set in this phase");
    mavenProject.addCompileSourceRoot(outputBaseDir.getPath());
}

From source file:org.onosproject.yang.compiler.plugin.maven.YangPluginUtils.java

License:Apache License

/**
 * Adds generated source directory to the compilation root.
 *
 * @param source  directory/*w w  w  .  j a  va2s .  c  om*/
 * @param project current maven project
 * @param context current build context
 */
static void addToCompilationRoot(String source, MavenProject project, BuildContext context) {
    project.addCompileSourceRoot(source);
    context.refresh(project.getBasedir());
    log.info("Source directory added to compilation root: " + source);
}