本文整理汇总了Java中org.apache.maven.artifact.handler.ArtifactHandler.getExtension方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactHandler.getExtension方法的具体用法?Java ArtifactHandler.getExtension怎么用?Java ArtifactHandler.getExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.artifact.handler.ArtifactHandler
的用法示例。
在下文中一共展示了ArtifactHandler.getExtension方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pathOf
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
@Override
public String pathOf( Artifact artifact )
{
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
StringBuilder path = new StringBuilder( 128 );
path.append( artifact.getGroupId() ).append( '/' );
path.append( artifactHandler.getDirectory() ).append( '/' );
path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
if ( artifact.hasClassifier() )
{
path.append( '-' ).append( artifact.getClassifier() );
}
if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
{
path.append( '.' ).append( artifactHandler.getExtension() );
}
return path.toString();
}
示例2: pathOf
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
public String pathOf( Artifact artifact )
{
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
StringBuffer path = new StringBuffer();
path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() );
if ( artifact.hasClassifier() )
{
path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() );
}
if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
{
path.append( GROUP_SEPARATOR ).append( artifactHandler.getExtension() );
}
return path.toString();
}
示例3: pathOf
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
public String pathOf( Artifact artifact )
{
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
StringBuilder path = new StringBuilder();
path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() );
if ( artifact.hasClassifier() )
{
path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() );
}
if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
{
path.append( GROUP_SEPARATOR ).append( artifactHandler.getExtension() );
}
return path.toString();
}
示例4: pathOf
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
public String pathOf( Artifact artifact )
{
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
StringBuilder path = new StringBuilder( 128 );
path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() );
if ( artifact.hasClassifier() )
{
path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() );
}
if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
{
path.append( GROUP_SEPARATOR ).append( artifactHandler.getExtension() );
}
return path.toString();
}
示例5: pathOf
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
public String pathOf( Artifact artifact )
{
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
StringBuilder path = new StringBuilder( 128 );
path.append( artifact.getGroupId() ).append( '/' );
path.append( artifactHandler.getDirectory() ).append( '/' );
path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
if ( artifact.hasClassifier() )
{
path.append( '-' ).append( artifact.getClassifier() );
}
if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
{
path.append( '.' ).append( artifactHandler.getExtension() );
}
return path.toString();
}
示例6: pathOf
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
public String pathOf( Artifact artifact )
{
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
StringBuilder path = new StringBuilder( 128 );
path.append( formatAsDirectory( artifact.getGroupId() ) ).append( PATH_SEPARATOR );
path.append( artifact.getArtifactId() ).append( PATH_SEPARATOR );
path.append( artifact.getBaseVersion() ).append( PATH_SEPARATOR );
path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() );
if ( artifact.hasClassifier() )
{
path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() );
}
if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
{
path.append( GROUP_SEPARATOR ).append( artifactHandler.getExtension() );
}
return path.toString();
}
示例7: pathBaseVersionOf
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
/**
* get relative path the copied artifact using base version. This is mainly use to SNAPSHOT instead of timestamp in
* the file name
*
* @param artifactRepositoryLayout
* @param artifact
* @return
*/
public static String pathBaseVersionOf( ArtifactRepositoryLayout artifactRepositoryLayout, Artifact artifact )
{
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
StringBuffer fileName = new StringBuffer();
fileName.append( artifact.getArtifactId() ).append( "-" ).append( artifact.getBaseVersion() );
if ( artifact.hasClassifier() )
{
fileName.append( "-" ).append( artifact.getClassifier() );
}
if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
{
fileName.append( "." ).append( artifactHandler.getExtension() );
}
String relativePath = artifactRepositoryLayout.pathOf( artifact );
String[] tokens = StringUtils.split( relativePath, "/" );
tokens[tokens.length - 1] = fileName.toString();
StringBuffer path = new StringBuffer();
for ( int i = 0; i < tokens.length; ++i )
{
path.append( tokens[i] );
if ( i != tokens.length - 1 )
{
path.append( "/" );
}
}
return path.toString();
}
示例8: newElement
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
public Xpp3Dom newElement(@Nonnull String name, @Nullable Artifact artifact) {
Xpp3Dom element = new Xpp3Dom(name);
if (artifact == null) {
return element;
}
element.setAttribute("groupId", artifact.getGroupId());
element.setAttribute("artifactId", artifact.getArtifactId());
element.setAttribute("baseVersion", artifact.getBaseVersion());
element.setAttribute("version", artifact.getVersion());
element.setAttribute("snapshot", String.valueOf(artifact.isSnapshot()));
if (artifact.getClassifier() != null) {
element.setAttribute("classifier", artifact.getClassifier());
}
element.setAttribute("type", artifact.getType());
element.setAttribute("id", artifact.getId());
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
String extension;
if (artifactHandler == null) {
extension = artifact.getType();
} else {
extension = artifactHandler.getExtension();
}
element.setAttribute("extension", extension);
return element;
}
示例9: convertExtension
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
private static String convertExtension(Artifact artifact) {
ArtifactHandler handler = artifact.getArtifactHandler();
String result = null;
if (handler != null) result = handler.getExtension();
if (result == null) result = artifact.getType();
return result;
}
示例10: convertExtension
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
private static String convertExtension(Artifact artifact) {
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
String result = null;
if (artifactHandler != null) {
result = artifactHandler.getExtension();
}
if (result == null) {
result = artifact.getType();
}
return result;
}
示例11: pathBaseVersionOf
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
/**
* get relative path the copied artifact using base version. This is mainly use to SNAPSHOT instead of timestamp in
* the file name
*
* @param artifactRepositoryLayout
* @param artifact
* @return
*/
public static String pathBaseVersionOf( ArtifactRepositoryLayout artifactRepositoryLayout, Artifact artifact )
{
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
StringBuilder fileName = new StringBuilder();
fileName.append( artifact.getArtifactId() ).append( "-" ).append( artifact.getBaseVersion() );
if ( artifact.hasClassifier() )
{
fileName.append( "-" ).append( artifact.getClassifier() );
}
if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
{
fileName.append( "." ).append( artifactHandler.getExtension() );
}
String relativePath = artifactRepositoryLayout.pathOf( artifact );
String[] tokens = StringUtils.split( relativePath, "/" );
tokens[tokens.length - 1] = fileName.toString();
StringBuilder path = new StringBuilder();
for ( int i = 0; i < tokens.length; ++i )
{
path.append( tokens[i] );
if ( i != tokens.length - 1 )
{
path.append( "/" );
}
}
return path.toString();
}
示例12: excludesDependencies
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
/**
* Creates a new ArtifactHandler for the specified Artifact that overrides the includeDependencies flag. When set, this flag prevents transitive
* dependencies from being printed in dependencies plugin.
*
* @param artifact The artifact
* @return The handler for the artifact
*/
private ArtifactHandler excludesDependencies(final Artifact artifact) {
final ArtifactHandler orig = artifact.getArtifactHandler();
return new ArtifactHandler() {
@Override
public String getExtension() {
return orig.getExtension();
}
@Override
public String getDirectory() {
return orig.getDirectory();
}
@Override
public String getClassifier() {
return orig.getClassifier();
}
@Override
public String getPackaging() {
return orig.getPackaging();
}
// mark dependencies has excluded so they will appear in tree listing
@Override
public boolean isIncludesDependencies() {
return false;
}
@Override
public String getLanguage() {
return orig.getLanguage();
}
@Override
public boolean isAddedToClasspath() {
return orig.isAddedToClasspath();
}
};
}
示例13: newArtifactType
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
public static ArtifactType newArtifactType(String id, ArtifactHandler handler) {
return new DefaultArtifactType(id, handler.getExtension(), handler.getClassifier(), handler.getLanguage(), handler.isAddedToClasspath(), handler.isIncludesDependencies());
}
示例14: newArtifactType
import org.apache.maven.artifact.handler.ArtifactHandler; //导入方法依赖的package包/类
public static ArtifactType newArtifactType( String id, ArtifactHandler handler )
{
return new DefaultArtifactType( id, handler.getExtension(), handler.getClassifier(), handler.getLanguage(),
handler.isAddedToClasspath(), handler.isIncludesDependencies() );
}