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

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

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

Build.getOutputDirectory介绍

[英]Get the directory where compiled application classes are placed. The default value is target/classes.
[中]获取放置已编译应用程序类的目录。默认值为target/classes

代码示例

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

@SuppressWarnings("unchecked")
public List<URL> build() throws MalformedURLException {
 List<URL> cp = new ArrayList<>();
 cp.addAll(resources(project.getResources()));
 cp.add(new File(project.getBuild().getOutputDirectory()).toURI().toURL());
 cp.addAll(jars(project.getArtifacts()));
 return cp;
}

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

public List getSystemClasspathElements()
  throws DependencyResolutionRequiredException
{
  List list = new ArrayList( getArtifacts().size() );
  list.add( getBuild().getOutputDirectory() );
  for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
  {
    Artifact a = (Artifact) i.next();
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO: let the scope handler deal with this
      if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
      {
        addArtifactPath( a, list );
      }
    }
  }
  return list;
}

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

@SuppressWarnings("unchecked")
protected final ClassLoader getClassLoader()
  throws MojoExecutionException, DependencyResolutionRequiredException {
  final MavenProject project = project();
  final List<String> classpathElements = new ArrayList<>();
  classpathElements.addAll(project.getCompileClasspathElements());
  classpathElements.addAll(project.getRuntimeClasspathElements());
  classpathElements.add(project.getBuild().getOutputDirectory());
  final List<URL> projectClasspathList = new ArrayList<>();
  for (final String element : classpathElements) {
    try {
      projectClasspathList.add(new File(element).toURI().toURL());
    } catch (final MalformedURLException ex) {
      throw new MojoExecutionException(
        element + " is an invalid classpath element", ex
      );
    }
  }
  return new URLClassLoader(
    projectClasspathList.toArray(new URL[projectClasspathList.size()]),
    Thread.currentThread().getContextClassLoader()
  );
}

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

public List getRuntimeClasspathElements()
  throws DependencyResolutionRequiredException
{
  List list = new ArrayList( getArtifacts().size() + 1 );
  list.add( getBuild().getOutputDirectory() );
  for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
  {
    Artifact a = (Artifact) i.next();
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO: let the scope handler deal with this
      if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
      {
        File file = a.getFile();
        if ( file == null )
        {
          throw new DependencyResolutionRequiredException( a );
        }
        list.add( file.getPath() );
      }
    }
  }
  return list;
}

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

public List getTestClasspathElements()
  throws DependencyResolutionRequiredException
{
  List list = new ArrayList( getArtifacts().size() + 1 );
  list.add( getBuild().getTestOutputDirectory() );
  list.add( getBuild().getOutputDirectory() );
  
  for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
  {
    Artifact a = (Artifact) i.next();
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO: let the scope handler deal with this
      // NOTE: [jc] scope == 'test' is the widest possible scope, so we don't really need to perform
      // this check...
      // if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() ) ||
      //     Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
      // {
      // }
      File file = a.getFile();
      if ( file == null )
      {
        throw new DependencyResolutionRequiredException( a );
      }
      list.add( file.getPath() );
    }
  }
  return list;
}

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

public List getCompileClasspathElements()
  throws DependencyResolutionRequiredException
{
  List list = new ArrayList( getArtifacts().size() );
  list.add( getBuild().getOutputDirectory() );
  for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
  {
    Artifact a = (Artifact) i.next();
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO: let the scope handler deal with this
      if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) ||
        Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
      {
        addArtifactPath( a, list );
      }
    }
  }
  return list;
}

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

@Deprecated
public List<String> getSystemClasspathElements()
  throws DependencyResolutionRequiredException
{
  List<String> list = new ArrayList<>( getArtifacts().size() );
  String d = getBuild().getOutputDirectory();
  if ( d != null )
  {
    list.add( d );
  }
  for ( Artifact a : getArtifacts() )
  {
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO let the scope handler deal with this
      if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
      {
        addArtifactPath( a, list );
      }
    }
  }
  return list;
}

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

public List<String> getTestClasspathElements()
  throws DependencyResolutionRequiredException
{
  List<String> list = new ArrayList<>( getArtifacts().size() + 2 );
  String d = getBuild().getTestOutputDirectory();
  if ( d != null )
  {
    list.add( d );
  }
  d = getBuild().getOutputDirectory();
  if ( d != null )
  {
    list.add( d );
  }
  for ( Artifact a : getArtifacts() )
  {
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      addArtifactPath( a, list );
    }
  }
  return list;
}

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

public List<String> getRuntimeClasspathElements()
  throws DependencyResolutionRequiredException
{
  List<String> list = new ArrayList<>( getArtifacts().size() + 1 );
  String d = getBuild().getOutputDirectory();
  if ( d != null )
  {
    list.add( d );
  }
  for ( Artifact a : getArtifacts() )
  {
    if ( a.getArtifactHandler().isAddedToClasspath()
    // TODO let the scope handler deal with this
      && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) )
    {
      addArtifactPath( a, list );
    }
  }
  return list;
}

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

public List<String> getCompileClasspathElements()
  throws DependencyResolutionRequiredException
{
  List<String> list = new ArrayList<>( getArtifacts().size() + 1 );
  String d = getBuild().getOutputDirectory();
  if ( d != null )
  {
    list.add( d );
  }
  for ( Artifact a : getArtifacts() )
  {
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO let the scope handler deal with this
      if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() )
        || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
      {
        addArtifactPath( a, list );
      }
    }
  }
  return list;
}

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

v.length() == 0 || v.endsWith(separator) ? v + s : v + separator + s);
properties.setProperty("platform.artifacts", project.getBuild().getOutputDirectory());
for (Artifact a : plugin.getArtifacts()) {
  String s = a.getFile().getCanonicalPath();

代码示例来源:origin: simpligility/android-maven-plugin

getLog().debug( "Adding dex input : " + project.getBuild().getOutputDirectory() );
for ( Artifact artifact : filterArtifacts( getTransitiveDependencyArtifacts(), skipDependencies,
  artifactTypeSet.getIncludes(), artifactTypeSet.getExcludes(), artifactSet.getIncludes(),

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

return new File( project.getBuild().getTestOutputDirectory() );
if ( project.hasLifecyclePhase( "compile" ) && COMPILE_PHASE_TYPES.contains( type ) )
  return new File( project.getBuild().getOutputDirectory() );

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

Build build = project.getBuild();
if ( !objectEquals( oBuild.getOutputDirectory(), build.getOutputDirectory() ) )

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

throws ModelInterpolationException
Build changedBuild = project.getBuild();
Build dynamicBuild = project.getDynamicBuild();
Build originalInterpolatedBuild = project.getOriginalInterpolatedBuild();
                             debugMessages ) );
dynamicBuild.setOutputDirectory( restoreString( dynamicBuild.getOutputDirectory(),
                          originalInterpolatedBuild.getOutputDirectory(),
                          changedBuild.getOutputDirectory(),
                          project,
                          config,

代码示例来源:origin: javalite/activejdbc

public void execute() throws MojoExecutionException, MojoFailureException {
    String targetDirectory = project.getBuild().getOutputDirectory();
    String htm = GitInfo.genHtml();
    try {
      FileOutputStream fout = new FileOutputStream(targetDirectory + System.getProperty("file.separator") + "git_info.html");
      fout.write(htm.getBytes());
    } catch (Exception e) {
      throw new ExecException(e);
    }
  }
}

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

private Collection<String> findOccupiedPackages() {
 String outputDirName = this.mojo.getProject().getBuild()
   .getOutputDirectory();
 File outputDir = new File(outputDirName);
 return findOccupiedPackagesIn(outputDir);
}

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

private void createArtifactJar(Set<Artifact> artifacts) throws Exception {
  List<PluginDescriptor> pluginDescriptors = getPluginDescriptors(artifacts);
  validateConfigForDuplicates();
  for (PluginConfig pluginConfig : pluginConfigs) {
    validateConfigItem(pluginDescriptors, pluginConfig);
  }
  String pluginsJson = transform(pluginDescriptors);
  File metaInfDir = new File(project.getBuild().getOutputDirectory(), "META-INF");
  File file = new File(metaInfDir, "glowroot.plugins.json");
  if (!metaInfDir.exists() && !metaInfDir.mkdirs()) {
    throw new IOException("Could not create directory: " + metaInfDir.getAbsolutePath());
  }
  Files.write(pluginsJson, file, UTF_8);
}

代码示例来源:origin: javaee/glassfish

private String getBuildClasspath() {
  StringBuilder sb = new StringBuilder();
  sb.append(project.getBuild().getOutputDirectory());
  sb.append(File.pathSeparator);
      project.getBuild().getOutputDirectory())) {

相关文章