當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。