本文整理汇总了Java中org.apache.maven.artifact.handler.DefaultArtifactHandler.setExtension方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultArtifactHandler.setExtension方法的具体用法?Java DefaultArtifactHandler.setExtension怎么用?Java DefaultArtifactHandler.setExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.artifact.handler.DefaultArtifactHandler
的用法示例。
在下文中一共展示了DefaultArtifactHandler.setExtension方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModelArtifact
import org.apache.maven.artifact.handler.DefaultArtifactHandler; //导入方法依赖的package包/类
/**
* Generate an model Artifact
*
* @param groupId String
* @param artifactId String
* @param version String
* @return Artifact
*/
private Artifact getModelArtifact(final String groupId, final String artifactId, final String version ){
final DefaultArtifactHandler handler = new DefaultArtifactHandler();
handler.setExtension("pom");
final Artifact model = new DefaultArtifact(
groupId,
artifactId,
version,
null,
"pom",
null ,
handler);
return model;
}
示例2: newHandler
import org.apache.maven.artifact.handler.DefaultArtifactHandler; //导入方法依赖的package包/类
private static ArtifactHandler newHandler(String type, String path) {
final String extension = (path == null) ? "" : FileUtils.extension(path);
if(isBlank(type)) {
type = extension;
}
DefaultArtifactHandler handler = new DefaultArtifactHandler(type);
if(! isBlank(extension)) {
handler.setExtension(extension);
}
return handler;
}
示例3: resolveArtifact
import org.apache.maven.artifact.handler.DefaultArtifactHandler; //导入方法依赖的package包/类
/**
* Resolve a dependency artifact
*
* @param project MavenProject
* @param dependency dependency
* @return Artifact
*/
public Artifact resolveArtifact(final MavenProject project, final Dependency dependency) throws MojoExecutionException {
// Manage version ranges
String version = dependency.getVersion();
try{
if(!version.matches("[0-9.]*")){
final VersionRange range = VersionRange.createFromVersionSpec(version);
version = getArtifactVersion(range);
}
}
catch (InvalidVersionSpecificationException e){
throw new MojoExecutionException("Failed to handle version range of " + dependency.toString(), e);
}
final DefaultArtifactHandler handler = new DefaultArtifactHandler();
handler.setExtension(dependency.getType());
final Artifact artifact = new DefaultArtifact(
dependency.getGroupId(),
dependency.getArtifactId(),
version,
null,
dependency.getType(),
dependency.getClassifier() ,
handler);
resolveArtifact(project, artifact);
return artifact;
}
示例4: generateDependency
import org.apache.maven.artifact.handler.DefaultArtifactHandler; //导入方法依赖的package包/类
@Test
public void generateDependency() throws MojoExecutionException {
final String groupId = "org.axway.grapes.test" ;
final String artifactId = "artifactId" ;
final String version = "1.0.0" ;
final String classifier = "linux" ;
final String type = "test-jar" ;
final String extension = "jar" ;
final String scope = "TEST" ;
final DefaultArtifactHandler handler = new DefaultArtifactHandler();
handler.setExtension(extension);
final org.apache.maven.artifact.Artifact mavenArtifact = new DefaultArtifact(
groupId,
artifactId,
version,
"COMPILE",
type,
classifier ,
handler);
final Dependency dependency = GrapesTranslator.getGrapesDependency(mavenArtifact, scope);
assertEquals(groupId, dependency.getTarget().getGroupId());
assertEquals(artifactId, dependency.getTarget().getArtifactId());
assertEquals(classifier, dependency.getTarget().getClassifier());
assertEquals(version, dependency.getTarget().getVersion());
assertEquals(type, dependency.getTarget().getType());
assertEquals(extension, dependency.getTarget().getExtension());
assertEquals(scope, dependency.getScope().toString());
}
示例5: newHandler
import org.apache.maven.artifact.handler.DefaultArtifactHandler; //导入方法依赖的package包/类
public static ArtifactHandler newHandler(Artifact artifact) {
String type = artifact.getProperty(ArtifactProperties.TYPE, artifact.getExtension());
DefaultArtifactHandler handler = new DefaultArtifactHandler(type);
handler.setExtension(artifact.getExtension());
handler.setLanguage(artifact.getProperty(ArtifactProperties.LANGUAGE, null));
handler.setAddedToClasspath(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.CONSTITUTES_BUILD_PATH, "")));
handler.setIncludesDependencies(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.INCLUDES_DEPENDENCIES, "")));
return handler;
}
示例6: newHandler
import org.apache.maven.artifact.handler.DefaultArtifactHandler; //导入方法依赖的package包/类
public static ArtifactHandler newHandler( Artifact artifact )
{
String type = artifact.getProperty( ArtifactProperties.TYPE, artifact.getExtension() );
DefaultArtifactHandler handler = new DefaultArtifactHandler( type );
handler.setExtension( artifact.getExtension() );
handler.setLanguage( artifact.getProperty( ArtifactProperties.LANGUAGE, null ) );
handler.setAddedToClasspath( Boolean.parseBoolean( artifact.getProperty( ArtifactProperties.CONSTITUTES_BUILD_PATH,
"" ) ) );
handler.setIncludesDependencies( Boolean.parseBoolean( artifact.getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES,
"" ) ) );
return handler;
}
示例7: newHandler
import org.apache.maven.artifact.handler.DefaultArtifactHandler; //导入方法依赖的package包/类
public static ArtifactHandler newHandler(Artifact artifact) {
String ext = "jar";
String type = "bundle";
DefaultArtifactHandler handler = new DefaultArtifactHandler(type);
handler.setExtension(ext);
handler.setLanguage("java");
handler.setAddedToClasspath(true);
handler.setIncludesDependencies(true);
return handler;
}