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

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

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

Build.getSourceDirectory介绍

[英]Get 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.
[中]Get此元素指定包含项目源的目录。生成的生成系统将在生成项目时编译来自此目录的源代码。给定的路径是相对于项目描述符的。默认值为src/main/java

代码示例

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

public String getSourceDirectory()
{
  return build.getSourceDirectory();
}

代码示例来源: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: jooby-project/jooby

resources.add(0, new File(project.getBuild().getSourceDirectory()));
List<Path> paths = resources.stream()
  .filter(File::exists)

代码示例来源:origin: jooby-project/jooby

@Override
 public void execute() throws MojoExecutionException, MojoFailureException {
  if (mainClass == null) {
   throw new MojoExecutionException("main class not configured");
  }

  try (URLClassLoader loader = new Classpath(mavenProject).toClassLoader()) {
   Path srcdir = new File(mavenProject.getBuild().getSourceDirectory()).toPath();
   Path bindir = new File(mavenProject.getBuild().getOutputDirectory()).toPath();
   getLog().debug("Using classloader " + loader);
   getLog().debug("    source: " + srcdir);
   getLog().debug("    bin: " + bindir);
   Path output = new ApiParser(srcdir)
     .with(loader)
     .export(bindir, mainClass);
   getLog().info("API file: " + output);
  } catch (Exception x) {
   throw new MojoFailureException("ApiTool resulted in exception: ", x);
  }
 }
}

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

if ( !objectEquals( oBuild.getSourceDirectory(), build.getSourceDirectory() ) )

代码示例来源: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: org.apache.maven/maven-project

project.addCompileSourceRoot( build.getSourceDirectory() );

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

if ( build.getSourceDirectory() != null )
  serializer.startTag( NAMESPACE, "sourceDirectory" ).text( build.getSourceDirectory() ).endTag( NAMESPACE, "sourceDirectory" );

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

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

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

project.addCompileSourceRoot( build.getSourceDirectory() );
project.addTestCompileSourceRoot( build.getTestSourceDirectory() );

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

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

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

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

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

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

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

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

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

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

代码示例来源:origin: INRIA/spoon

/**
 * Get the list of source directories of the project
 * @return the list of source directories
 */
public List<File> getSourceDirectories() {
  List<File> output = new ArrayList<>();
  String sourcePath = null;
  Build build = model.getBuild();
  if (build != null) {
    sourcePath = build.getSourceDirectory();
  }
  if (sourcePath == null) {
    sourcePath = Paths.get(directory.getAbsolutePath(), "src", "main", "java").toString();
  }
  File source = new File(sourcePath);
  if (source.exists()) {
    output.add(source);
  }
  File generatedSource = Paths.get(directory.getAbsolutePath(), "target", "generated-sources").toFile();
  if (generatedSource.exists()) {
    output.add(generatedSource);
  }
  for (SpoonPom module : modules) {
    output.addAll(module.getSourceDirectories());
  }
  return output;
}

代码示例来源:origin: hcoles/pitest

private List<String> findModifiedClassNames() throws MojoExecutionException {
 final File sourceRoot = new File(this.project.getBuild()
   .getSourceDirectory());
 final List<String> modifiedPaths = FCollection.map(findModifiedPaths(), pathByScmDir());
 return FCollection.flatMap(modifiedPaths, new PathToJavaClassConverter(
     sourceRoot.getAbsolutePath()));
}

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

out.write("        build()" + br);
if (build.getSourceDirectory() != null) {
  out.write("            .sourceDirectory(\"" + build.getSourceDirectory() + "\")" + br);

相关文章