當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultArtifact.setFile方法代碼示例

本文整理匯總了Java中org.apache.maven.artifact.DefaultArtifact.setFile方法的典型用法代碼示例。如果您正苦於以下問題:Java DefaultArtifact.setFile方法的具體用法?Java DefaultArtifact.setFile怎麽用?Java DefaultArtifact.setFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.maven.artifact.DefaultArtifact的用法示例。


在下文中一共展示了DefaultArtifact.setFile方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: newMavenArtifact

import org.apache.maven.artifact.DefaultArtifact; //導入方法依賴的package包/類
protected DefaultArtifact newMavenArtifact(Artifact da) {
    DefaultArtifact result = new org.apache.maven.artifact.DefaultArtifact(
        da.getGroupId(), da.getArtifactId(), da.getVersion(),
        null, da.getExtension(), da.getClassifier(), artifactHandler);
    result.setFile(da.getFile());
    return result;
}
 
開發者ID:ahgittin,項目名稱:license-audit-maven-plugin,代碼行數:8,代碼來源:AbstractLicensingMojo.java

示例2: setUp

import org.apache.maven.artifact.DefaultArtifact; //導入方法依賴的package包/類
@Override
public void setUp()
    throws Exception
{
    super.setUp();
    DefaultArtifactHandler artifactHandler = new DefaultArtifactHandler( "jar" );
    artifact1 =
        new DefaultArtifact( "groupId", "artifact1", VersionRange.createFromVersion( "1.0" ), "scope", "jar",
                             "classifier", artifactHandler );
    artifact1.setFile( new File( "artifact1-1.0.jar" ) );
    artifact2 =
        new DefaultArtifact( "groupId", "artifact2", VersionRange.createFromVersion( "1.5" ), null, "jar", "",
                             artifactHandler );
    artifact2.setFile( new File( "artifact2-1.5.jar" ) );

    // add a SNAPSHOT artifact, timestamped (from a remote maven repository)
    artifact3 =
            new DefaultArtifact( "groupId", "artifact3", VersionRange.createFromVersion( "1.5-SNAPSHOT" ), null, "jar", "",
                                 artifactHandler );
    artifact3.setVersion("1.5-15012014.121212-1");
    artifact3.setFile( new File( "artifact3-1.5-15012014.121212-1.jar" ) );

    // add a SNAPSHOT artifact, not timestamped (from a local build)
    artifact4 =
            new DefaultArtifact( "groupId", "artifact4", VersionRange.createFromVersion( "1.5-SNAPSHOT" ), null, "jar", "",
                                 artifactHandler );
    artifact4.setFile( new File( "artifact4-1.5-SNAPSHOT.jar" ) );

    artifacts = new ArrayList<>();

    artifacts.add( artifact1 );
    artifacts.add( artifact2 );
    artifacts.add( artifact3 );
    artifacts.add( artifact4 );
}
 
開發者ID:mojohaus,項目名稱:webstart,代碼行數:36,代碼來源:GeneratorTest.java

示例3: newMojoExecution

import org.apache.maven.artifact.DefaultArtifact; //導入方法依賴的package包/類
private MojoExecution newMojoExecution(Xpp3Dom... parameters) throws IOException {
  MojoExecution execution = mojos.newMojoExecution("testProperties", parameters);
  PluginDescriptor pluginDescriptor = execution.getMojoDescriptor().getPluginDescriptor();

  ArtifactHandler handler = new DefaultArtifactHandler("jar");
  DefaultArtifact workspaceResolver = new DefaultArtifact("io.takari.m2e.workspace", "org.eclipse.m2e.workspace.cli", "1", Artifact.SCOPE_COMPILE, ".jar", null, handler);
  workspaceResolver.setFile(new File("target/workspaceResolver.jar").getCanonicalFile());

  List<Artifact> pluginArtifacts = new ArrayList<>(pluginDescriptor.getArtifacts());
  pluginArtifacts.add(workspaceResolver);
  pluginDescriptor.setArtifacts(pluginArtifacts);

  return execution;
}
 
開發者ID:takari,項目名稱:takari-lifecycle,代碼行數:15,代碼來源:TestPropertiesMojoTest.java

示例4: create

import org.apache.maven.artifact.DefaultArtifact; //導入方法依賴的package包/類
private Artifact create(String g, String a, String v) {
    DefaultArtifact artifact = new MavenArtifact();
    artifact.setGroupId(g);
    artifact.setArtifactId(a);
    artifact.setVersion(v);
    artifact.setFile(new File("target/junk/" + a + "-" + v + ".jar"));
    return artifact;
}
 
開發者ID:wisdom-framework,項目名稱:wisdom,代碼行數:9,代碼來源:DependencyEmbedderTest.java

示例5: renderModuleXmlWithMavenDependencies

import org.apache.maven.artifact.DefaultArtifact; //導入方法依賴的package包/類
@Test
public void renderModuleXmlWithMavenDependencies() throws Exception {
  final DefaultArtifact artifactCompileScope = new DefaultArtifact("groupId1", "artifactId1",
      "1.0", "compile", "jar", null,        artifactResolver);
  artifactCompileScope.setFile(new File("artifact1-1.0.jar"));
  final DefaultArtifact artifactRunetimeScope = new DefaultArtifact("groupId2", "artifactId2",
      "2.0", "runtime", "jar", null,        artifactResolver);
  artifactRunetimeScope.setFile(new File("artifact2-2.0.jar"));

  Set<Artifact> mavenDependencies = new HashSet<>();
  mavenDependencies.add(artifactCompileScope);
  mavenDependencies.add(artifactRunetimeScope);
  mavenDependencies.add(new DefaultArtifact("groupId3","artifdactId3","3.0","test","jar",null,
      artifactResolver));

  when(project.getGroupId()).thenReturn("group");
  when(project.getArtifactId()).thenReturn("test");
  when(project.getVersion()).thenReturn("1.0");
  when(project.getArtifacts()).thenReturn(mavenDependencies);

  RandomAccessFile moduleVM = new RandomAccessFile(sourceFile, "rw");

  moduleVM.writeBytes("<module>\n#addHeader($project)\n\n <resources>\n" +
      "#addResources($project \"module\" \"lib\")\n </resources>\n\n</module>");
  moduleVM.close();

  Writer writer = new StringWriter();

  testling.renderModuleXml(writer, relativeModuleVMPath);

  assertThat(writer.toString(), is(
      "<module>\n" +
          "    <name>test</name>\n" +
          "    <version>1.0</version>\n" +
          "\n" +
          " <resources>\n" +
          "    <resource scope=\"server\" name=\"groupId2:artifactId2\" version=\"2.0\">" +
          "lib/artifact2-2.0.jar</resource>\n" +
          "    <resource scope=\"module\" name=\"groupId1:artifactId1\" version=\"1.0\">" +
          "lib/artifact1-1.0.jar</resource>\n" +
          " </resources>\n" +
          "\n" +
          "</module>"));
}
 
開發者ID:zaplatynski,項目名稱:fsm-packagetype,代碼行數:45,代碼來源:VelocityManagerTest.java

示例6: renderModuleXmlWithMavenDependenciesModeIsolated

import org.apache.maven.artifact.DefaultArtifact; //導入方法依賴的package包/類
@Test
public void renderModuleXmlWithMavenDependenciesModeIsolated() throws Exception {

  reset(project);

  mavenProjectProperties.setProperty("fsmode", "isolated");
  when(project.getProperties()).thenReturn(mavenProjectProperties);

  when(parentProject.getBasedir()).thenReturn(templateRoot);
  when(project.getBasedir()).thenReturn(templateRoot);
  when(project.getParent()).thenReturn(parentProject);

  testling = new VelocityManager(project);

  final DefaultArtifact artifactCompileScope = new DefaultArtifact("groupId1", "artifdactId1",
      "1.0", "compile", "jar", null,        artifactResolver);
  artifactCompileScope.setFile(new File("artifact1-1.0.jar"));
  final DefaultArtifact artifactRunetimeScope = new DefaultArtifact("groupId2", "artifdactId2",
      "2.0", "runtime", "jar", null,        artifactResolver);
  artifactRunetimeScope.setFile(new File("artifact2-2.0.jar"));

  Set<Artifact> mavenDependencies = new HashSet<>();
  mavenDependencies.add(artifactCompileScope);
  mavenDependencies.add(artifactRunetimeScope);
  mavenDependencies.add(new DefaultArtifact("groupId3","artifdactId3","3.0","test","jar",null,
      artifactResolver));

  when(project.getGroupId()).thenReturn("group");
  when(project.getArtifactId()).thenReturn("test");
  when(project.getVersion()).thenReturn("1.0");
  when(project.getArtifacts()).thenReturn(mavenDependencies);

  RandomAccessFile moduleVM = new RandomAccessFile(sourceFile, "rw");

  moduleVM.writeBytes("<module>\n#addHeader($project)\n\n <resources>\n" +
      "#addResources($project \"module\" \"lib\")\n </resources>\n\n</module>");
  moduleVM.close();

  Writer writer = new StringWriter();

  testling.renderModuleXml(writer, relativeModuleVMPath);

  assertThat(writer.toString(), is(
      "<module>\n" +
          "    <name>test</name>\n" +
          "    <version>1.0</version>\n" +
          "\n" +
          " <resources>\n" +
          "    <resource mode=\"isolated\" scope=\"module\" name=\"groupId1:artifdactId1\" " +
          "version=\"1.0\">lib/artifact1-1.0.jar</resource>\n" +
          "    <resource mode=\"isolated\" scope=\"module\" name=\"groupId2:artifdactId2\" " +
          "version=\"2.0\">lib/artifact2-2.0.jar</resource>\n" +
          " </resources>\n" +
          "\n" +
          "</module>"));
}
 
開發者ID:zaplatynski,項目名稱:fsm-packagetype,代碼行數:57,代碼來源:VelocityManagerTest.java

示例7: attachPrimaryArtifact

import org.apache.maven.artifact.DefaultArtifact; //導入方法依賴的package包/類
/**
 *
 */
private void attachPrimaryArtifact()
{
    Artifact artifact = this.project.getArtifact();

    if ( null == this.classifier )
    {
        artifact.setFile( new File( this.linkerOutputDirectory + "/" + this.project.getBuild().getFinalName() + "."
            + this.project.getArtifact().getArtifactHandler().getExtension() ) );
    }
    else
    {
        // install primary artifact as a classifier

        DefaultArtifact clone =
            new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(),
                                 artifact.getVersionRange().cloneOf(), artifact.getScope(), artifact.getType(),
                                 classifier, artifact.getArtifactHandler(), artifact.isOptional() );

        clone.setRelease( artifact.isRelease() );
        clone.setResolvedVersion( artifact.getVersion() );
        clone.setResolved( artifact.isResolved() );
        clone.setFile( artifact.getFile() );

        if ( artifact.getAvailableVersions() != null )
        {
            clone.setAvailableVersions( new ArrayList( artifact.getAvailableVersions() ) );
        }

        clone.setBaseVersion( artifact.getBaseVersion() );
        clone.setDependencyFilter( artifact.getDependencyFilter() );

        if ( artifact.getDependencyTrail() != null )
        {
            clone.setDependencyTrail( new ArrayList( artifact.getDependencyTrail() ) );
        }

        clone.setDownloadUrl( artifact.getDownloadUrl() );
        clone.setRepository( artifact.getRepository() );

        clone.setFile( new File( this.linkerOutputDirectory + "/" + this.project.getBuild().getFinalName() + "."
            + this.project.getArtifact().getArtifactHandler().getExtension() ) );

        project.setArtifact( clone );
    }
}
 
開發者ID:mojohaus,項目名稱:maven-native,代碼行數:49,代碼來源:NativeLinkMojo.java

示例8: createArtifact

import org.apache.maven.artifact.DefaultArtifact; //導入方法依賴的package包/類
Artifact createArtifact(File file, String groupId, String artifactId, String version, String scope, String type, String classifier) {
    DefaultArtifact artifact = new DefaultArtifact(groupId, artifactId, version, scope, type, classifier, artifactHandler);
    artifact.setFile(file);
    artifact.setResolved(true);
    return artifact;
}
 
開發者ID:sundrio,項目名稱:sundrio,代碼行數:7,代碼來源:AbstractSundrioMojo.java


注:本文中的org.apache.maven.artifact.DefaultArtifact.setFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。