本文整理汇总了Java中org.apache.maven.plugin.testing.stubs.ArtifactStub类的典型用法代码示例。如果您正苦于以下问题:Java ArtifactStub类的具体用法?Java ArtifactStub怎么用?Java ArtifactStub使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArtifactStub类属于org.apache.maven.plugin.testing.stubs包,在下文中一共展示了ArtifactStub类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setupNativeHelper
import org.apache.maven.plugin.testing.stubs.ArtifactStub; //导入依赖的package包/类
@Before
public void setupNativeHelper() {
MavenProject project = new MavenProject();
project.setDependencyArtifacts(Collections.<Artifact>emptySet());
ArtifactStub apklib = new ArtifactStub() {
@Override
public String getId() {
return getArtifactId();
}
};
apklib.setArtifactId("some-apklib");
apklib.setGroupId("group");
apklib.setType(AndroidExtension.APKLIB);
project.addAttachedArtifact(apklib);
final DependencyGraphBuilder dependencyGraphBuilder = new DefaultDependencyGraphBuilder();
nativeHelper = new NativeHelper(project, dependencyGraphBuilder, new SilentLog());
}
开发者ID:simpligility,项目名称:android-ndk-maven-plugin,代码行数:20,代码来源:NativeHelperTest.java
示例2: createsClassPathEntryForKnownProject
import org.apache.maven.plugin.testing.stubs.ArtifactStub; //导入依赖的package包/类
@Test
public void createsClassPathEntryForKnownProject() throws MojoExecutionException {
MavenProject firstProject = givenMavenProject("firstProject");
Artifact artifact = new ArtifactStub();
artifact.setGroupId("de.is24.junit");
artifact.setArtifactId("firstProject");
artifact.setVersion("42");
artifact.setScope("compile");
mavenProject.setArtifacts(newHashSet(artifact));
Iterable<Module> modules = objectUnderTest.getModulesFor(asList(firstProject, mavenProject));
assertThat(modules, is(Matchers.<Module>iterableWithSize(2)));
Module module = Iterables.getLast(modules);
assertThat(module.getClassPath(), is(Matchers.<File>iterableWithSize(1)));
}
开发者ID:ImmobilienScout24,项目名称:deadcode4j,代码行数:17,代码来源:A_ModuleGenerator.java
示例3: givenMavenProject
import org.apache.maven.plugin.testing.stubs.ArtifactStub; //导入依赖的package包/类
private MavenProject givenMavenProject(String projectId) {
MavenProject mavenProject = new MavenProject();
mavenProject.setGroupId("de.is24.junit");
mavenProject.setArtifactId(projectId);
mavenProject.setVersion("42");
mavenProject.getProperties().setProperty("project.build.sourceEncoding", "UTF-8");
ArtifactStub projectArtifact = new ArtifactStub();
projectArtifact.setGroupId("de.is24.junit");
projectArtifact.setArtifactId(projectId);
projectArtifact.setVersion("42");
mavenProject.setArtifact(projectArtifact);
Build build = new Build();
build.setOutputDirectory(tempFileRule.getTempFile().getParent());
mavenProject.setBuild(build);
return mavenProject;
}
开发者ID:ImmobilienScout24,项目名称:deadcode4j,代码行数:17,代码来源:A_ModuleGenerator.java
示例4: makeArtifact
import org.apache.maven.plugin.testing.stubs.ArtifactStub; //导入依赖的package包/类
private Artifact makeArtifact(File file) {
final Artifact artifact = new ArtifactStub();
artifact.setArtifactId("artifactId");
artifact.setGroupId("groupId");
artifact.setScope("scope");
artifact.setVersion("0.123456789");
artifact.setFile(file);
return artifact;
}
开发者ID:ImmobilienScout24,项目名称:illegal-transitive-dependency-check,代码行数:10,代码来源:ArtifactRepositoryAnalyzerTest.java
示例5: excludesUsedUndeclaredDependencies
import org.apache.maven.plugin.testing.stubs.ArtifactStub; //导入依赖的package包/类
/**
* DependencyValidator can exclude used undeclared dependencies.
* @throws Exception If something wrong happens inside
*/
@Test
public void excludesUsedUndeclaredDependencies() throws Exception {
final ProjectDependencyAnalysis analysis =
Mockito.mock(ProjectDependencyAnalysis.class);
final Set<Artifact> used = new HashSet<>();
final ArtifactStub artifact = new ArtifactStub();
artifact.setGroupId("group");
artifact.setArtifactId("artifact");
artifact.setScope(DependenciesValidatorTest.SCOPE);
artifact.setVersion("2.3.4");
artifact.setType(DependenciesValidatorTest.TYPE);
used.add(artifact);
Mockito.doReturn(used).when(analysis).getUsedUndeclaredArtifacts();
final ProjectDependencyAnalyzer analyzer = this.analyzer(analysis);
final MavenEnvironment env = new MavenEnvironmentMocker().inPlexus(
DependenciesValidatorTest.ROLE,
DependenciesValidatorTest.HINT,
analyzer
).mock();
new DependenciesValidator().validate(
new MavenEnvironment.Wrap(
new Environment.Mock().withExcludes(
Joiner.on(':').join(
artifact.getGroupId(), artifact.getArtifactId()
)
), env
)
);
}
开发者ID:teamed,项目名称:qulice,代码行数:34,代码来源:DependenciesValidatorTest.java
示例6: excludesUnusedDeclaredDependencies
import org.apache.maven.plugin.testing.stubs.ArtifactStub; //导入依赖的package包/类
/**
* DependencyValidator can exclude unused declared dependencies.
* @throws Exception If something wrong happens inside
*/
@Test
public void excludesUnusedDeclaredDependencies() throws Exception {
final ProjectDependencyAnalysis analysis =
Mockito.mock(ProjectDependencyAnalysis.class);
final Set<Artifact> unused = new HashSet<>();
final ArtifactStub artifact = new ArtifactStub();
artifact.setGroupId("othergroup");
artifact.setArtifactId("otherartifact");
artifact.setScope(DependenciesValidatorTest.SCOPE);
artifact.setVersion("1.2.3");
artifact.setType(DependenciesValidatorTest.TYPE);
unused.add(artifact);
Mockito.doReturn(unused).when(analysis).getUnusedDeclaredArtifacts();
final ProjectDependencyAnalyzer analyzer = this.analyzer(analysis);
final MavenEnvironment env = new MavenEnvironmentMocker().inPlexus(
DependenciesValidatorTest.ROLE,
DependenciesValidatorTest.HINT,
analyzer
).mock();
new DependenciesValidator().validate(
new MavenEnvironment.Wrap(
new Environment.Mock().withExcludes(
Joiner.on(':').join(
artifact.getGroupId(), artifact.getArtifactId()
)
), env
)
);
}
开发者ID:teamed,项目名称:qulice,代码行数:34,代码来源:DependenciesValidatorTest.java
示例7: addArtifact
import org.apache.maven.plugin.testing.stubs.ArtifactStub; //导入依赖的package包/类
private Artifact addArtifact(MavenProject mavenProject, final boolean resolved) {
Artifact artifact = new ArtifactStub() {
private boolean resolved = false;
@Override
public boolean isResolved() {
return this.resolved;
}
@Override
public void setResolved(boolean b) {
this.resolved = b;
}
@Override
public File getFile() {
return isResolved() ? super.getFile() : null;
}
};
artifact.setGroupId("de.is24.junit");
artifact.setArtifactId("dependency");
artifact.setVersion("42");
artifact.setScope("compile");
artifact.setResolved(resolved);
artifact.setFile(tempFileRule.getTempFile());
mavenProject.setArtifactFilter(new ScopeArtifactFilter(SCOPE_COMPILE_PLUS_RUNTIME));
if (resolved) {
mavenProject.setResolvedArtifacts(newHashSet(artifact));
} else {
mavenProject.setArtifacts(newHashSet(artifact));
}
return artifact;
}
开发者ID:ImmobilienScout24,项目名称:deadcode4j,代码行数:35,代码来源:A_ModuleGenerator.java
示例8: ProjectStub
import org.apache.maven.plugin.testing.stubs.ArtifactStub; //导入依赖的package包/类
public ProjectStub() {
ArtifactStub artifact = new ArtifactStub();
artifact.setGroupId("de.is24.junit");
artifact.setArtifactId("project");
artifact.setVersion("42");
setArtifact(artifact);
setGroupId(artifact.getGroupId());
setArtifactId(artifact.getArtifactId());
setVersion(artifact.getVersion());
setPackaging("jar");
setCompileSourceRoots(newArrayList("src/test/java/"));
properties.setProperty("project.build.sourceEncoding", "UTF-8");
}
开发者ID:ImmobilienScout24,项目名称:deadcode4j,代码行数:16,代码来源:ProjectStub.java
示例9: buildJarResource
import org.apache.maven.plugin.testing.stubs.ArtifactStub; //导入依赖的package包/类
private ResolvedJarResource buildJarResource( final String hrefValue, final String version, final String mainClass,
final boolean outputJarVersion, final boolean includeInJnlp )
{
return new ResolvedJarResource( new ArtifactStub() )
{
/**
* {@inheritDoc}
*/
public String getHrefValue()
{
return hrefValue;
}
/**
* {@inheritDoc}
*/
public String getMainClass()
{
return mainClass;
}
/**
* {@inheritDoc}
*/
public String getVersion()
{
return version;
}
/**
* {@inheritDoc}
*/
public boolean isIncludeInJnlp()
{
return includeInJnlp;
}
/**
* {@inheritDoc}
*/
public boolean isOutputJarVersion()
{
return outputJarVersion;
}
};
}
开发者ID:mojohaus,项目名称:webstart,代码行数:51,代码来源:JarResourcesGeneratorTest.java
示例10: ProjectStub
import org.apache.maven.plugin.testing.stubs.ArtifactStub; //导入依赖的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);
}
Artifact artifact = new ArtifactStub();
artifact.setArtifactId(model.getArtifactId());
artifact.setGroupId(model.getGroupId());
artifact.setVersion(model.getVersion());
setArtifact(artifact);
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:vongosling,项目名称:dependency-mediator,代码行数:44,代码来源:ProjectStub.java
注:本文中的org.apache.maven.plugin.testing.stubs.ArtifactStub类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论