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


Java ArtifactHandler类代码示例

本文整理汇总了Java中org.apache.maven.artifact.handler.ArtifactHandler的典型用法代码示例。如果您正苦于以下问题:Java ArtifactHandler类的具体用法?Java ArtifactHandler怎么用?Java ArtifactHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setUp

import org.apache.maven.artifact.handler.ArtifactHandler; //导入依赖的package包/类
protected void setUp()
    throws Exception
{
    super.setUp();

    ArtifactHandler ah = new DefaultArtifactHandlerStub( "jar", null );
    VersionRange vr = VersionRange.createFromVersion( "1.1" );
    release = new DefaultArtifact( "test", "one", vr, Artifact.SCOPE_COMPILE, "jar", "sources", ah, false );
    artifacts.add( release );

    ah = new DefaultArtifactHandlerStub( "war", null );
    vr = VersionRange.createFromVersion( "1.1-SNAPSHOT" );
    snap = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "war", null, ah, false );
    artifacts.add( snap );

    ah = new DefaultArtifactHandlerStub( "war", null );
    vr = VersionRange.createFromVersion( "1.1-SNAPSHOT" );
    sources = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "sources", "sources", ah, false );

    // pick random output location
    Random a = new Random();
    outputFolder = new File( "target/copy" + a.nextLong() + "/" );
    outputFolder.delete();
    assertFalse( outputFolder.exists() );
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:26,代码来源:TestDependencyUtil.java

示例2: 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();
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:24,代码来源:LegacyRepositoryLayout.java

示例3: 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();
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:21,代码来源:FlatRepositoryLayout.java

示例4: testMojoLookup

import org.apache.maven.artifact.handler.ArtifactHandler; //导入依赖的package包/类
public void testMojoLookup()
    throws Exception
{
    File pluginXml = new File( getBasedir(), "src/test/resources/linker/plugin-config-ranlib.xml" );
    NativeRanlibMojo mojo = (NativeRanlibMojo) lookupMojo( "ranlib", pluginXml );
    assertNotNull( mojo );

    // simulate artifact
    ArtifactHandler artifactHandler = new DefaultArtifactHandler();

    Artifact artifact =
        new DefaultArtifact( "test", "test", VersionRange.createFromVersion( "1.0-SNAPSHOT" ), "compile", "exe",
                             null, artifactHandler );
    mojo.getProject().setArtifact( artifact );

    mojo.execute();
}
 
开发者ID:mojohaus,项目名称:maven-native,代码行数:18,代码来源:NativeRanlibMojoTest.java

示例5: testMojoLookup

import org.apache.maven.artifact.handler.ArtifactHandler; //导入依赖的package包/类
public void testMojoLookup()
    throws Exception
{
    File pluginXml = new File( getBasedir(), "src/test/resources/initialize/plugin-config.xml" );
    NativeInitializeMojo mojo = (NativeInitializeMojo) lookupMojo( "initialize", pluginXml );
    assertNotNull( mojo );

    // simulate artifact
    ArtifactHandler artifactHandler = new DefaultArtifactHandler();
    Artifact artifact =
        new DefaultArtifact( "test", "test", VersionRange.createFromVersion( "1.0-SNAPSHOT" ), "compile", "exe",
                             null, artifactHandler );
    mojo.project.setArtifact( artifact );
    mojo.setPluginContext( new HashMap() );

    mojo.execute();

    assertEquals( "someArtifactId", mojo.project.getBuild().getFinalName() );
}
 
开发者ID:mojohaus,项目名称:maven-native,代码行数:20,代码来源:NativeInitializeMojoTest.java

示例6: 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();
}
 
开发者ID:mojohaus,项目名称:appassembler,代码行数:21,代码来源:FlatRepositoryLayout.java

示例7: 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();
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:21,代码来源:FlatRepositoryLayout.java

示例8: 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();
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:23,代码来源:LegacyRepositoryLayout.java

示例9: attachArtifact

import org.apache.maven.artifact.handler.ArtifactHandler; //导入依赖的package包/类
public void attachArtifact( MavenProject project, String artifactType, String artifactClassifier,
                            File artifactFile )
{
    String type = artifactType;

    ArtifactHandler handler = null;

    if ( type != null )
    {
        handler = artifactHandlerManager.getArtifactHandler( artifactType );
    }

    if ( handler == null )
    {
        handler = artifactHandlerManager.getArtifactHandler( "jar" );
    }

    Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, artifactClassifier, handler );

    artifact.setFile( artifactFile );
    artifact.setResolved( true );

    attachArtifact( project, artifact );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:25,代码来源:DefaultMavenProjectHelper.java

示例10: AttachedArtifact

import org.apache.maven.artifact.handler.ArtifactHandler; //导入依赖的package包/类
public AttachedArtifact( Artifact parent, String type, String classifier, ArtifactHandler artifactHandler )
{
    super( parent.getGroupId(), parent.getArtifactId(), parent.getVersionRange(), parent.getScope(), type,
           classifier, artifactHandler, parent.isOptional() );

    setDependencyTrail( Collections.singletonList( parent.getId() ) );

    this.parent = parent;

    if ( getId().equals( parent.getId() ) )
    {
        throw new InvalidArtifactRTException( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(),
                                              parent.getType(), "An attached artifact must have a different ID"
                                                  + " than its corresponding main artifact." );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:17,代码来源:AttachedArtifact.java

示例11: 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();
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:24,代码来源:DefaultRepositoryLayout.java

示例12: findGwt

import org.apache.maven.artifact.handler.ArtifactHandler; //导入依赖的package包/类
@Override
protected Pair<String, Boolean> findGwt(String cp, String cpSep) {
  VersionRange versions;
  try {
    versions = VersionRange.createFromVersionSpec("[2.5.0,)");
  } catch (InvalidVersionSpecificationException e) {
    throw X_Debug.rethrow(e);
  }

  ArtifactHandler artifactHandler = new DefaultArtifactHandler("default");
  Artifact gwtUser = new DefaultArtifact("com.google.gwt", "gwt-user", versions, "compile", "default", "jar",
      artifactHandler);
  // Check maven first
  Artifact local = getSession().getLocalRepository().find(gwtUser);
  if (local != null) {
    return PairBuilder.pairOf(local.getFile().getParentFile().getParent(), true);
  }
  return super.findGwt(cp, cpSep);
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:20,代码来源:CodeServerMojo.java

示例13: testTestJar

import org.apache.maven.artifact.handler.ArtifactHandler; //导入依赖的package包/类
public void testTestJar()
{
    ArtifactHandler ah = new DefaultArtifactHandlerStub( "test-jar", null );
    VersionRange vr = VersionRange.createFromVersion( "1.1-SNAPSHOT" );
    Artifact artifact = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "test-jar", null, ah,
                                             false );

    String name = DependencyUtil.getFormattedFileName( artifact, false );
    String expectedResult = "two-1.1-SNAPSHOT.jar";
    assertEquals( expectedResult, name );

}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:13,代码来源:TestDependencyUtil.java

示例14: getArtifact

import org.apache.maven.artifact.handler.ArtifactHandler; //导入依赖的package包/类
public Artifact getArtifact()
{
    if ( artifact == null )
    {
        ArtifactHandler ah = new DefaultArtifactHandlerStub( "jar", null );

        VersionRange vr = VersionRange.createFromVersion( "1.0" );
        Artifact art = new DefaultArtifact( "group", "artifact", vr, Artifact.SCOPE_COMPILE, "jar", null, ah, false );
        setArtifact( art );
    }
    return artifact;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:13,代码来源:DependencyProjectStub.java

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

}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:46,代码来源:ArtifactUtils.java


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