當前位置: 首頁>>代碼示例>>Java>>正文


Java Build.setSourceDirectory方法代碼示例

本文整理匯總了Java中org.apache.maven.model.Build.setSourceDirectory方法的典型用法代碼示例。如果您正苦於以下問題:Java Build.setSourceDirectory方法的具體用法?Java Build.setSourceDirectory怎麽用?Java Build.setSourceDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.maven.model.Build的用法示例。


在下文中一共展示了Build.setSourceDirectory方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ProjectStub

import org.apache.maven.model.Build; //導入方法依賴的package包/類
/**
 * Default constructor
 */
public ProjectStub() {
    MavenXpp3Reader pomReader = new MavenXpp3Reader();
    Model model;
    try {
        model = pomReader.read(ReaderFactory.newXmlReader(new File(getBasedir(), "pom.xml")));
        setModel(model);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    setGroupId(model.getGroupId());
    setArtifactId(model.getArtifactId());
    setVersion(model.getVersion());
    setName(model.getName());
    setUrl(model.getUrl());
    setPackaging(model.getPackaging());

    Build build = new Build();
    build.setFinalName(model.getArtifactId());
    build.setDirectory(getBasedir() + "/target");
    build.setSourceDirectory(getBasedir() + "/src/main/java");
    build.setOutputDirectory(getBasedir() + "/target/classes");
    build.setTestSourceDirectory(getBasedir() + "/src/test/java");
    build.setTestOutputDirectory(getBasedir() + "/target/test-classes");
    setBuild(build);

    List<String> compileSourceRoots = new ArrayList<String>();
    compileSourceRoots.add(getBasedir() + "/src/main/java");
    setCompileSourceRoots(compileSourceRoots);

    List<String> testCompileSourceRoots = new ArrayList<String>();
    testCompileSourceRoots.add(getBasedir() + "/src/test/java");
    setTestCompileSourceRoots(testCompileSourceRoots);
}
 
開發者ID:pmd,項目名稱:build-tools,代碼行數:38,代碼來源:ProjectStub.java

示例2: setupBuild

import org.apache.maven.model.Build; //導入方法依賴的package包/類
private void setupBuild(Model model) {
  Build build = new Build();

  build.setFinalName(model.getArtifactId());
  build.setDirectory(getBasedir() + "/target");
  build.setSourceDirectory(getBasedir() + "/src/main/java");
  build.setOutputDirectory(getBasedir() + "/target/classes");
  build.setTestSourceDirectory(getBasedir() + "/src/test/java");
  build.setTestOutputDirectory(getBasedir() + "/target/test-classes");
  build.setPlugins(model.getBuild().getPlugins());

  setBuild(build);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:14,代碼來源:ProjectStub.java

示例3: TypeScriptDTOGeneratorMojoProjectStub

import org.apache.maven.model.Build; //導入方法依賴的package包/類
/** Default constructor */
public TypeScriptDTOGeneratorMojoProjectStub() {
  MavenXpp3Reader pomReader = new MavenXpp3Reader();
  Model model;
  try {
    model = pomReader.read(ReaderFactory.newXmlReader(new File(getBasedir(), "pom.xml")));
    setModel(model);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }

  setGroupId(model.getGroupId());
  setArtifactId(model.getArtifactId());
  setVersion(model.getVersion());
  setName(model.getName());
  setUrl(model.getUrl());
  setPackaging(model.getPackaging());

  Build build = new Build();
  build.setFinalName(model.getArtifactId());
  build.setDirectory(getBasedir() + "/target");
  build.setSourceDirectory(getBasedir() + "/src/main/java");
  build.setOutputDirectory(getBasedir() + "/target/classes");
  build.setTestSourceDirectory(getBasedir() + "/src/test/java");
  build.setTestOutputDirectory(getBasedir() + "/target/test-classes");
  setBuild(build);

  List compileSourceRoots = new ArrayList();
  compileSourceRoots.add(getBasedir() + "/src/main/java");
  setCompileSourceRoots(compileSourceRoots);

  List testCompileSourceRoots = new ArrayList();
  testCompileSourceRoots.add(getBasedir() + "/src/test/java");
  setTestCompileSourceRoots(testCompileSourceRoots);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:36,代碼來源:TypeScriptDTOGeneratorMojoProjectStub.java

示例4: DynaModuleListGeneratorMojoProjectStub

import org.apache.maven.model.Build; //導入方法依賴的package包/類
/** Default constructor */
public DynaModuleListGeneratorMojoProjectStub() {
  MavenXpp3Reader pomReader = new MavenXpp3Reader();
  Model model;
  try {
    model = pomReader.read(ReaderFactory.newXmlReader(new File(getBasedir(), "pom.xml")));
    setModel(model);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }

  setGroupId(model.getGroupId());
  setArtifactId(model.getArtifactId());
  setVersion(model.getVersion());
  setName(model.getName());
  setUrl(model.getUrl());
  setPackaging(model.getPackaging());
  setDependencies(model.getDependencies());

  Build build = new Build();
  build.setFinalName(model.getArtifactId());
  build.setDirectory(getBasedir() + "/target");
  build.setSourceDirectory(getBasedir() + "/src/main/java");
  build.setOutputDirectory(getBasedir() + "/target/classes");
  build.setTestSourceDirectory(getBasedir() + "/src/test/java");
  build.setTestOutputDirectory(getBasedir() + "/target/test-classes");
  setBuild(build);

  List compileSourceRoots = new ArrayList();
  compileSourceRoots.add(getBasedir() + "/src/main/java");
  setCompileSourceRoots(compileSourceRoots);

  List testCompileSourceRoots = new ArrayList();
  testCompileSourceRoots.add(getBasedir() + "/src/test/java");
  setTestCompileSourceRoots(testCompileSourceRoots);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:37,代碼來源:DynaModuleListGeneratorMojoProjectStub.java

示例5: initiate

import org.apache.maven.model.Build; //導入方法依賴的package包/類
private void initiate()
{
    MavenXpp3Reader pomReader = new MavenXpp3Reader();
    Model model;
    try
    {
        model = pomReader.read( ReaderFactory.newXmlReader( new File( getBasedir(), "pom.xml" ) ) );
        setModel( model );
    }
    catch ( Exception e )
    {
        throw new RuntimeException( e );
    }

    setGroupId( model.getGroupId() );
    setArtifactId( model.getArtifactId() );
    setVersion( model.getVersion() );
    setName( model.getName() );
    setUrl( model.getUrl() );
    setPackaging( model.getPackaging() );

    Build build = new Build();
    build.setFinalName( model.getArtifactId() );
    build.setDirectory( getBasedir() + "/target" );
    build.setSourceDirectory( getBasedir() + "/src/main/java" );
    build.setOutputDirectory( getBasedir() + "/target/classes" );
    build.setTestSourceDirectory( getBasedir() + "/src/test/java" );
    build.setTestOutputDirectory( getBasedir() + "/target/test-classes" );
    setBuild( build );

    List<String> compileSourceRoots = new ArrayList<String>();
    compileSourceRoots.add( getBasedir() + "/src/main/java" );
    setCompileSourceRoots( compileSourceRoots );

    List<String> testCompileSourceRoots = new ArrayList<String>();
    testCompileSourceRoots.add( getBasedir() + "/src/test/java" );
    setTestCompileSourceRoots( testCompileSourceRoots );
}
 
開發者ID:mojohaus,項目名稱:templating-maven-plugin,代碼行數:39,代碼來源:MavenProjectStub.java

示例6: testBuildPluginUpdateExisting

import org.apache.maven.model.Build; //導入方法依賴的package包/類
@Test
public void testBuildPluginUpdateExisting() throws Exception {
    org.guvnor.common.services.project.model.Build from = new org.guvnor.common.services.project.model.Build();
    from.getPlugins().add(makeGuvnorPlugin("myGroup",
                                           "myArtifact",
                                           "1.0"));

    Build to = new Build();
    Plugin toPlugin = makeMavenPlugin("myGroup",
                                      "myArtifact",
                                      "0.11.11.12");
    to.getPlugins().add(toPlugin);
    toPlugin.setGoals("someGoal");
    to.setSourceDirectory("someDirectory");

    to = new BuildContentHandler().update(from,
                                          to);

    assertEquals(1,
                 to.getPlugins().size());
    assertEquals("1.0",
                 to.getPlugins().get(0).getVersion());
    assertEquals("someGoal",
                 to.getPlugins().get(0).getGoals());
    assertEquals("someDirectory",
                 to.getSourceDirectory());
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:28,代碼來源:BuildContentHandlerTest.java

示例7: CreateSpdxMavenProjectStub

import org.apache.maven.model.Build; //導入方法依賴的package包/類
public CreateSpdxMavenProjectStub() {
    MavenXpp3Reader pomReader = new MavenXpp3Reader();
    Model model;
    try
    {
        model = pomReader.read( ReaderFactory.newXmlReader( new File( getBasedir(), "pom.xml" ) ) );
        setModel( model );
    }
    catch ( Exception e )
    {
        throw new RuntimeException( e );
    }

    setGroupId( model.getGroupId() );
    setArtifactId( model.getArtifactId() );
    setVersion( model.getVersion() );
    setName( model.getName() );
    setUrl( model.getUrl() );
    setPackaging( model.getPackaging() );

    Build build = new Build();
    build.setFinalName( model.getArtifactId() );
    build.setDirectory( getBasedir() + "/target" );
    build.setSourceDirectory( getBasedir() + "/src/main/java" );
    build.setOutputDirectory( getBasedir() + "/target/classes" );
    build.setTestSourceDirectory( getBasedir() + "/src/test/java" );
    build.setTestOutputDirectory( getBasedir() + "/target/test-classes" );
    setBuild( build );

    List<String> compileSourceRoots = new ArrayList<String>();
    compileSourceRoots.add( getBasedir() + "/src/main/java" );
    setCompileSourceRoots( compileSourceRoots );

    List<String> testCompileSourceRoots = new ArrayList<String>();
    testCompileSourceRoots.add( getBasedir() + "/src/test/java" );
    setTestCompileSourceRoots( testCompileSourceRoots );
}
 
開發者ID:spdx,項目名稱:spdx-maven-plugin,代碼行數:38,代碼來源:CreateSpdxMavenProjectStub.java

示例8: mergeBuild_SourceDirectory

import org.apache.maven.model.Build; //導入方法依賴的package包/類
protected void mergeBuild_SourceDirectory( Build target, Build source, boolean sourceDominant,
                                           Map<Object, Object> context )
{
    String src = source.getSourceDirectory();
    if ( src != null )
    {
        if ( sourceDominant || target.getSourceDirectory() == null )
        {
            target.setSourceDirectory( src );
            target.setLocation( "sourceDirectory", source.getLocation( "sourceDirectory" ) );
        }
    }
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:14,代碼來源:ModelMerger.java

示例9: CreateSpdxMavenProjectStub

import org.apache.maven.model.Build; //導入方法依賴的package包/類
public CreateSpdxMavenProjectStub() {
    MavenXpp3Reader pomReader = new MavenXpp3Reader();
    Model model;
    try
    {
        model = pomReader.read( ReaderFactory.newXmlReader( new File( getBasedir(), "pom.xml" ) ) );
        setModel( model );
    }
    catch ( Exception e )
    {
        throw new RuntimeException( e );
    }

    setGroupId( model.getGroupId() );
    setArtifactId( model.getArtifactId() );
    setVersion( model.getVersion() );
    setName( model.getName() );
    setUrl( model.getUrl() );
    setPackaging( model.getPackaging() );

    Build build = new Build();
    build.setFinalName( model.getArtifactId() );
    build.setDirectory( getBasedir() + "/target" );
    build.setSourceDirectory( getBasedir() + "/src/main/java" );
    build.setOutputDirectory( getBasedir() + "/target/classes" );
    build.setTestSourceDirectory( getBasedir() + "/src/test/java" );
    build.setTestOutputDirectory( getBasedir() + "/target/test-classes" );
    setBuild( build );
    
    Reporting reporting = new Reporting();
    reporting.setOutputDirectory( getBaseDir() + "/target/site" );
    setReporting( reporting );

    List<String> compileSourceRoots = new ArrayList<String>();
    compileSourceRoots.add( getBasedir() + "/src/main/java" );
    setCompileSourceRoots( compileSourceRoots );

    List<String> testCompileSourceRoots = new ArrayList<String>();
    testCompileSourceRoots.add( getBasedir() + "/src/test/java" );
    setTestCompileSourceRoots( testCompileSourceRoots );
}
 
開發者ID:spdx,項目名稱:spdx-maven-plugin,代碼行數:42,代碼來源:CreateSpdxMavenProjectStub.java

示例10: ProjectStub

import org.apache.maven.model.Build; //導入方法依賴的package包/類
/**
 * Default constructor
 */
public ProjectStub() {
    MavenXpp3Reader pomReader = new MavenXpp3Reader();
    Model model;
    try {
        model = pomReader.read(ReaderFactory.newXmlReader(new File(getBasedir(), "pom.xml")));
        setModel(model);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    Artifact artifact = new ArtifactStub();
    artifact.setArtifactId(model.getArtifactId());
    artifact.setGroupId(model.getGroupId());
    artifact.setVersion(model.getVersion());
    setArtifact(artifact);

    setGroupId(model.getGroupId());
    setArtifactId(model.getArtifactId());
    setVersion(model.getVersion());
    setName(model.getName());
    setUrl(model.getUrl());
    setPackaging(model.getPackaging());

    Build build = new Build();
    build.setFinalName(model.getArtifactId());
    build.setDirectory(getBasedir() + "/target");
    build.setSourceDirectory(getBasedir() + "/src/main/java");
    build.setOutputDirectory(getBasedir() + "/target/classes");
    build.setTestSourceDirectory(getBasedir() + "/src/test/java");
    build.setTestOutputDirectory(getBasedir() + "/target/test-classes");
    setBuild(build);

    List<String> compileSourceRoots = new ArrayList<String>();
    compileSourceRoots.add(getBasedir() + "/src/main/java");
    setCompileSourceRoots(compileSourceRoots);

    List<String> testCompileSourceRoots = new ArrayList<String>();
    testCompileSourceRoots.add(getBasedir() + "/src/test/java");
    setTestCompileSourceRoots(testCompileSourceRoots);
}
 
開發者ID:vongosling,項目名稱:dependency-mediator,代碼行數:44,代碼來源:ProjectStub.java

示例11: assembleBuildInheritance

import org.apache.maven.model.Build; //導入方法依賴的package包/類
@SuppressWarnings( "unchecked" )
public void assembleBuildInheritance( Build childBuild, Build parentBuild, boolean handleAsInheritance )
{
    // The build has been set but we want to step in here and fill in
    // values that have not been set by the child.

    if ( childBuild.getSourceDirectory() == null )
    {
        childBuild.setSourceDirectory( parentBuild.getSourceDirectory() );
    }

    if ( childBuild.getScriptSourceDirectory() == null )
    {
        childBuild.setScriptSourceDirectory( parentBuild.getScriptSourceDirectory() );
    }

    if ( childBuild.getTestSourceDirectory() == null )
    {
        childBuild.setTestSourceDirectory( parentBuild.getTestSourceDirectory() );
    }

    if ( childBuild.getOutputDirectory() == null )
    {
        childBuild.setOutputDirectory( parentBuild.getOutputDirectory() );
    }

    if ( childBuild.getTestOutputDirectory() == null )
    {
        childBuild.setTestOutputDirectory( parentBuild.getTestOutputDirectory() );
    }

    // Extensions are accumulated
    mergeExtensionLists( childBuild, parentBuild );

    if ( childBuild.getDirectory() == null )
    {
        childBuild.setDirectory( parentBuild.getDirectory() );
    }

    if ( childBuild.getDefaultGoal() == null )
    {
        childBuild.setDefaultGoal( parentBuild.getDefaultGoal() );
    }

    if ( childBuild.getFinalName() == null )
    {
        childBuild.setFinalName( parentBuild.getFinalName() );
    }

    ModelUtils.mergeFilterLists( childBuild.getFilters(), parentBuild.getFilters() );

    List<Resource> resources = childBuild.getResources();
    if ( ( resources == null ) || resources.isEmpty() )
    {
        childBuild.setResources( parentBuild.getResources() );
    }

    resources = childBuild.getTestResources();
    if ( ( resources == null ) || resources.isEmpty() )
    {
        childBuild.setTestResources( parentBuild.getTestResources() );
    }

    // Plugins are aggregated if Plugin.inherit != false
    ModelUtils.mergePluginLists( childBuild, parentBuild, handleAsInheritance );

    // Plugin management :: aggregate
    PluginManagement dominantPM = childBuild.getPluginManagement();
    PluginManagement recessivePM = parentBuild.getPluginManagement();

    if ( ( dominantPM == null ) && ( recessivePM != null ) )
    {
        // FIXME: Filter out the inherited == false stuff!
        childBuild.setPluginManagement( recessivePM );
    }
    else
    {
        ModelUtils.mergePluginLists( childBuild.getPluginManagement(), parentBuild.getPluginManagement(), false );
    }
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:81,代碼來源:DefaultModelInheritanceAssembler.java

示例12: PkgProjectStub

import org.apache.maven.model.Build; //導入方法依賴的package包/類
/**
 * Default constructor
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public PkgProjectStub(File pom) {
	MavenXpp3Reader pomReader = new MavenXpp3Reader();
	Model model;
	try {
		model = pomReader.read(ReaderFactory.newXmlReader(pom));
		setModel(model);
	} catch (Exception e) {
		throw new RuntimeException(e);
	}

	setGroupId(model.getGroupId());
	setArtifactId(model.getArtifactId());
	setVersion(model.getVersion());
	setName(model.getName());
	setUrl(model.getUrl());
	setPackaging(model.getPackaging());

	List<ArtifactRepository> artifacRepoList = Collections.emptyList();
	setRemoteArtifactRepositories(artifacRepoList);

	Build build = new Build();
	build.setFinalName(model.getArtifactId());
	build.setDirectory(getBasedir() + "/target");
	build.setSourceDirectory(getBasedir() + "/src/main/java");
	build.setOutputDirectory(getBasedir() + "/target/classes");
	build.setTestSourceDirectory(getBasedir() + "/src/test/java");
	build.setTestOutputDirectory(getBasedir() + "/target/test-classes");
	setBuild(build);

	setDependencies(model.getDependencies());
	this.setDependencyArtifacts(new HashSet());

	List compileSourceRoots = new ArrayList();
	compileSourceRoots.add(getBasedir() + "/src/main/java");
	setCompileSourceRoots(compileSourceRoots);

	List testCompileSourceRoots = new ArrayList();
	testCompileSourceRoots.add(getBasedir() + "/src/test/java");
	setTestCompileSourceRoots(testCompileSourceRoots);
}
 
開發者ID:tarent,項目名稱:pkg-maven-plugin,代碼行數:45,代碼來源:PkgProjectStub.java

示例13: testShouldInterpolateSourceDirectoryReferencedFromResourceDirectoryCorrectly

import org.apache.maven.model.Build; //導入方法依賴的package包/類
public void testShouldInterpolateSourceDirectoryReferencedFromResourceDirectoryCorrectly()
    throws Exception
{
    Model model = new Model();

    Build build = new Build();
    build.setSourceDirectory( "correct" );

    Resource res = new Resource();
    res.setDirectory( "${project.build.sourceDirectory}" );

    build.addResource( res );

    Resource res2 = new Resource();
    res2.setDirectory( "${pom.build.sourceDirectory}" );

    build.addResource( res2 );

    Resource res3 = new Resource();
    res3.setDirectory( "${build.sourceDirectory}" );

    build.addResource( res3 );

    model.setBuild( build );

    ModelInterpolator interpolator = createInterpolator();

    final SimpleProblemCollector collector = new SimpleProblemCollector();
    Model out = interpolator.interpolateModel( model, null, createModelBuildingRequest( context ), collector );
    assertColllectorState( 0, 0, 2, collector );
    
    
    List<Resource> outResources = out.getBuild().getResources();
    Iterator<Resource> resIt = outResources.iterator();

    assertEquals( build.getSourceDirectory(), resIt.next().getDirectory() );
    assertEquals( build.getSourceDirectory(), resIt.next().getDirectory() );
    assertEquals( build.getSourceDirectory(), resIt.next().getDirectory() );
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:40,代碼來源:AbstractModelInterpolatorTest.java


注:本文中的org.apache.maven.model.Build.setSourceDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。