当前位置: 首页>>代码示例>>Java>>正文


Java Build.setDirectory方法代码示例

本文整理汇总了Java中org.apache.maven.model.Build.setDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java Build.setDirectory方法的具体用法?Java Build.setDirectory怎么用?Java Build.setDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.model.Build的用法示例。


在下文中一共展示了Build.setDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DiffusionProjectStub

import org.apache.maven.model.Build; //导入方法依赖的package包/类
public DiffusionProjectStub(final File buildDirectory, final File pom)
        throws Exception {

    super(new DiffusionModelStub());

    setExecutionProject(this);

    setFile(pom);

    final Build build = new Build();
    build.setDirectory(buildDirectory.getAbsolutePath());
    setBuild(build);
    setDependencyArtifacts((Set)emptySet());
    setArtifacts((Set)emptySet());
    setPluginArtifacts((Set)emptySet());
    setReportArtifacts((Set)emptySet());
    setExtensionArtifacts((Set)emptySet());
    setRemoteArtifactRepositories((List)emptyList());
    setPluginArtifactRepositories((List)emptyList());
    setCollectedProjects((List)emptyList());
    setActiveProfiles((List)emptyList());
}
 
开发者ID:pushtechnology,项目名称:diffusion-maven-plugin,代码行数:23,代码来源:DiffusionProjectStub.java

示例2: testValueExtractionWithAPomValueContainingAPath

import org.apache.maven.model.Build; //导入方法依赖的package包/类
public void testValueExtractionWithAPomValueContainingAPath()
    throws Exception
{
    String expected = getTestFile( "target/test-classes/target/classes" ).getCanonicalPath();

    Build build = new Build();
    build.setDirectory( expected.substring( 0, expected.length() - "/classes".length() ) );

    Model model = new Model();
    model.setBuild( build );

    MavenProject project = new MavenProject( model );
    project.setFile( new File( "pom.xml" ).getCanonicalFile() );

    ExpressionEvaluator expressionEvaluator = createExpressionEvaluator( project, null, new Properties() );

    Object value = expressionEvaluator.evaluate( "${project.build.directory}/classes" );
    String actual = new File( value.toString() ).getCanonicalPath();

    assertEquals( expected, actual );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:22,代码来源:PluginParameterExpressionEvaluatorTest.java

示例3: testTwoExpressions

import org.apache.maven.model.Build; //导入方法依赖的package包/类
public void testTwoExpressions()
    throws Exception
{
    Build build = new Build();
    build.setDirectory( "expected-directory" );
    build.setFinalName( "expected-finalName" );

    Model model = new Model();
    model.setBuild( build );

    ExpressionEvaluator expressionEvaluator =
        createExpressionEvaluator( new MavenProject( model ), null, new Properties() );

    Object value = expressionEvaluator.evaluate( "${project.build.directory}" + FS + "${project.build.finalName}" );

    assertEquals( "expected-directory" + File.separatorChar + "expected-finalName", value );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:PluginParameterExpressionEvaluatorTest.java

示例4: DARMavenProjectStub

import org.apache.maven.model.Build; //导入方法依赖的package包/类
public DARMavenProjectStub(final File buildDirectory, final File pom)
    throws Exception {

super(new DARModelStub());

setExecutionProject(this);

setFile(pom);

final Build build = new Build();
build.setDirectory(buildDirectory.getAbsolutePath());
setBuild(build);

setArtifact(new DARArtifactStub());

setDependencyArtifacts(emptySet());
setArtifacts(emptySet());
setPluginArtifacts(emptySet());
setReportArtifacts(emptySet());
setExtensionArtifacts(emptySet());
setRemoteArtifactRepositories(emptyList());
setPluginArtifactRepositories(emptyList());
setCollectedProjects(emptyList());
setActiveProfiles(emptyList());
   }
 
开发者ID:pushtechnology,项目名称:mvndar,代码行数:26,代码来源:DARMavenProjectStub.java

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: prepareArtifactTargetClassesDirectory

import org.apache.maven.model.Build; //导入方法依赖的package包/类
static void prepareArtifactTargetClassesDirectory(MavenProject project, Class<?> clazz) {
  final ClassFileReference classFileReference = makeClassFileSet(clazz).iterator().next();
  final Build build = new Build();
  project.setBuild(build);
  build.setDirectory(classFileReference.getClassFile().getParentFile().getAbsolutePath());
  build.setOutputDirectory(classFileReference.getClassFile().getParentFile().getAbsolutePath());
}
 
开发者ID:ImmobilienScout24,项目名称:illegal-transitive-dependency-check,代码行数:8,代码来源:ClassFileReference.java

示例11: 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

示例12: shouldNotUnpackViewResourcesThatDoNotMatchTheFilters

import org.apache.maven.model.Build; //导入方法依赖的package包/类
@Test
public void shouldNotUnpackViewResourcesThatDoNotMatchTheFilters() throws MojoExecutionException,
        MojoFailureException, NoSuchArchiverException, ArchiverException {
    // Given
    UnpackViewResources mojo = new UnpackViewResources() {
        @Override
        protected Embedder newEmbedder() {
            return new Embedder();
        }

    };
    ArchiverManager archiveManager = mock(ArchiverManager.class);
    MavenProject project = mock(MavenProject.class);

    File resourcesFile = new File("some");
    Artifact someResources = mock(Artifact.class);
    when(someResources.getArtifactId()).thenReturn("some-resources");
    when(someResources.getType()).thenReturn("jar");
    when(someResources.getFile()).thenReturn(resourcesFile);

    Set<Artifact> allArtifacts = new HashSet<Artifact>();
    allArtifacts.add(someResources);

    String buildDirectory = "target";
    Build build = new Build();
    build.setDirectory(buildDirectory);

    // When
    mojo.project = project;
    mojo.archiverManager = archiveManager;
    mojo.resourceIncludes = "ftl/*";
    mojo.resourcesExcludes = "com/*";
    when(project.getArtifacts()).thenReturn(allArtifacts);
    when(project.getBuild()).thenReturn(build);

    mojo.execute();

    // Then
    verify(archiveManager, Mockito.never()).getUnArchiver(resourcesFile);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:41,代码来源:EmbedderMojoBehaviour.java

示例13: shouldNotIgnoreFailureInUnpackingViewResources

import org.apache.maven.model.Build; //导入方法依赖的package包/类
@Test(expected = MojoExecutionException.class)
public void shouldNotIgnoreFailureInUnpackingViewResources() throws MojoExecutionException, MojoFailureException,
        NoSuchArchiverException, ArchiverException {
    // Given
    UnpackViewResources mojo = new UnpackViewResources() {
        @Override
        protected Embedder newEmbedder() {
            return new Embedder();
        }

    };
    ArchiverManager archiveManager = mock(ArchiverManager.class);
    MavenProject project = mock(MavenProject.class);

    File coreFile = new File("core");
    Artifact coreResources = mock(Artifact.class);
    when(coreResources.getArtifactId()).thenReturn("jbehave-core");
    when(coreResources.getType()).thenReturn("zip");
    when(coreResources.getFile()).thenReturn(coreFile);
    File siteFile = new File("site");
    Artifact siteResources = mock(Artifact.class);
    when(siteResources.getArtifactId()).thenReturn("jbehave-site-resources");
    when(siteResources.getType()).thenReturn("zip");
    when(siteResources.getFile()).thenReturn(siteFile);

    Set<Artifact> allArtifacts = new HashSet<Artifact>();
    allArtifacts.add(coreResources);
    allArtifacts.add(siteResources);

    String buildDirectory = "target";
    Build build = new Build();
    build.setDirectory(buildDirectory);

    UnArchiver coreArchiver = mock(UnArchiver.class);
    UnArchiver siteArchiver = mock(UnArchiver.class);

    // When
    mojo.project = project;
    mojo.archiverManager = archiveManager;
    when(project.getArtifacts()).thenReturn(allArtifacts);
    when(project.getBuild()).thenReturn(build);
    when(archiveManager.getUnArchiver(coreFile)).thenReturn(coreArchiver);
    when(archiveManager.getUnArchiver(siteFile)).thenReturn(siteArchiver);
    Mockito.doThrow(new ArchiverException("bum")).when(siteArchiver).extract();

    mojo.execute();

    // Then
    verify(coreArchiver).extract();
    // and fail as expected ...
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:52,代码来源:EmbedderMojoBehaviour.java

示例14: createProject

import org.apache.maven.model.Build; //导入方法依赖的package包/类
/**
 * Creates the maven project.
 *
 * @return the created project.
 * @throws IOException never.
 */
protected MavenProject createProject() throws IOException
{
  final BuildMetaDataProjectStub project = new BuildMetaDataProjectStub();
  final Model model = createModel();
  project.setFile(testPomFile);
  project.setBasedir(targetDir.getParentFile());
  project.setModel(model);
  project.setGroupId(model.getGroupId());
  project.setArtifactId(model.getArtifactId());
  final Build build = new Build();
  build.setDirectory(targetDir.getAbsolutePath());
  build.setOutputDirectory(new File(targetDir, "classes").getAbsolutePath());
  model.setBuild(build);

  Writer writer = null;
  try
  {
    writer = new BufferedWriter(new FileWriter(testPomFile));
    project.writeModel(writer);
  }
  finally
  {
    IOUtil.close(writer);
  }
  return project;
}
 
开发者ID:release-engineering,项目名称:buildmetadata-maven-plugin,代码行数:33,代码来源:BuildMetaDataMojoTest.java

示例15: 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


注:本文中的org.apache.maven.model.Build.setDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。