org.apache.maven.model.Build.setSourceDirectory()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中org.apache.maven.model.Build.setSourceDirectory()方法的一些代码示例,展示了Build.setSourceDirectory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Build.setSourceDirectory()方法的具体详情如下:
包路径:org.apache.maven.model.Build
类名称:Build
方法名:setSourceDirectory

Build.setSourceDirectory介绍

[英]Set this element specifies a directory containing the source of the project. The generated build system will compile the sources from this directory when the project is built. The path given is relative to the project descriptor. The default value is src/main/java.
[中]Set此元素指定包含项目源的目录。生成的生成系统将在生成项目时编译来自此目录的源代码。给定的路径是相对于项目描述符的。默认值为src/main/java

代码示例

代码示例来源:origin: org.apache.maven/maven-project

public void setSourceDirectory( String sourceDirectory )
{
  build.setSourceDirectory( sourceDirectory );
}

代码示例来源:origin: apache/maven

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" ) );
    }
  }
}

代码示例来源:origin: org.apache.maven/maven-project

build.setSourceDirectory( alignToBaseDirectory( build.getSourceDirectory(), basedir ) );

代码示例来源:origin: org.apache.maven/maven-project

build.setSourceDirectory( unalignFromBaseDirectory( build.getSourceDirectory(), basedir ) );

代码示例来源:origin: org.apache.maven/maven-project

public static Build cloneBuild( Build src )
{
  if ( src == null )
  {
    return null;
  }
  Build result = new Build();
  
  cloneBuildBaseFields( src, result );
  
  result.setExtensions( cloneList( src.getExtensions(), EXTENSION_CLONER ) );
  result.setOutputDirectory( src.getOutputDirectory() );
  
  result.setScriptSourceDirectory( src.getScriptSourceDirectory() );
  result.setSourceDirectory( src.getSourceDirectory() );
  result.setTestOutputDirectory( src.getTestOutputDirectory() );
  result.setTestSourceDirectory( src.getTestSourceDirectory() );
  
  return result;
}

代码示例来源:origin: apache/maven

build.setSourceDirectory( alignToBaseDirectory( build.getSourceDirectory(), basedir ) );

代码示例来源:origin: apache/maven

build.setSourceDirectory( alignToBaseDirectory( build.getSourceDirectory(), basedir ) );

代码示例来源:origin: apache/maven

build.setSourceDirectory( unalignFromBaseDirectory( build.getSourceDirectory(), basedir ) );

代码示例来源:origin: org.apache.maven/maven-project

childBuild.setSourceDirectory( parentBuild.getSourceDirectory() );

代码示例来源:origin: apache/maven

childBuild.setSourceDirectory( parentBuild.getSourceDirectory() );

代码示例来源:origin: takari/polyglot-maven

public BuildBuilder sourceDirectory(String sourceDirectory) {
  if (sourceDirectory != null) {
    getBuild().setSourceDirectory(sourceDirectory);
  }
  return this;
}

代码示例来源:origin: apache/maven

build.setSourceDirectory( interpolatedTrimmed( parser.nextText(), "sourceDirectory" ) );

代码示例来源:origin: org.apache.maven/maven-project

debugMessages ) );
dynamicBuild.setSourceDirectory( restoreString( dynamicBuild.getSourceDirectory(),
                          originalInterpolatedBuild.getSourceDirectory(),
                          changedBuild.getSourceDirectory(),

代码示例来源:origin: apache/maven

build.setSourceDirectory( interpolatedTrimmed( parser.nextText(), "sourceDirectory" ) );

代码示例来源:origin: takari/polyglot-maven

build.setSourceDirectory( getTrimmedValue( value ) );

代码示例来源:origin: takari/polyglot-maven

build.setSourceDirectory(srcDir);

代码示例来源:origin: io.tesla.maven/maven-model

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" ) );
    }
  }
}

代码示例来源:origin: org.apache.maven.plugins/maven-clover-plugin

private void redirectSourceDirectories()
{
  String oldSourceDirectory = getProject().getBuild().getSourceDirectory();
  if ( new File( oldSourceDirectory ).exists() )
  {
    getProject().getBuild().setSourceDirectory( this.cloverOutputSourceDirectory );
  }
  getLog().debug( "Clover source directories before change:" );
  logSourceDirectories();
  // Maven2 limitation: changing the source directory doesn't change the compile source roots
  // See http://jira.codehaus.org/browse/MNG-1945
  List sourceRoots = new ArrayList( getProject().getCompileSourceRoots() );
  // Clean all source roots to add them again in order to keep the same original order of source roots.
  getProject().getCompileSourceRoots().removeAll( sourceRoots );
  for ( Iterator i = sourceRoots.iterator(); i.hasNext(); )
  {
    String sourceRoot = (String) i.next();
    if ( new File( oldSourceDirectory ).exists() && sourceRoot.equals( oldSourceDirectory ) )
    {
      getProject().addCompileSourceRoot( getProject().getBuild().getSourceDirectory() );
    }
    else
    {
      getProject().addCompileSourceRoot( sourceRoot );
    }
  }
  getLog().debug( "Clover source directories after change:" );
  logSourceDirectories();
}

代码示例来源:origin: errai/errai

protected File getTestSourceDirectory(final Project project) {
 final MavenFacet mavenFacet = project.getFacet(MavenFacet.class);
 final Model pom = mavenFacet.getModel();
 Build build = pom.getBuild();
 
 if (build == null) {
  build = new Build();
  pom.setBuild(build);
 }

 String testSourceDirectoryPath = build.getTestSourceDirectory();
 
 if (testSourceDirectoryPath == null) {
  testSourceDirectoryPath = "src/test/java";
  build.setSourceDirectory(testSourceDirectoryPath);
 }

 return new File(project.getRootDirectory().getUnderlyingResourceObject(),
     testSourceDirectoryPath).getAbsoluteFile();
}

代码示例来源:origin: org.guvnor/guvnor-project-backend

@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());
}

相关文章