本文整理汇总了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());
}
示例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 );
}
示例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 );
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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 );
}
示例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 );
}
示例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);
}
示例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 ...
}
示例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;
}
示例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 );
}