• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SubArtifact类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: publish

import org.eclipse.aether.util.artifact.SubArtifact; //导入依赖的package包/类
/**
 * @param descriptor an {@link Artifact}, holding the maven coordinates for the published files
 *     less the extension that is to be derived from the files. The {@code descriptor} itself will
 *     not be published as is, and the {@link File} attached to it (if any) will be ignored.
 * @param toPublish {@link File}(s) to be published using the given coordinates. The filename
 *     extension of each given file will be used as a maven "extension" coordinate
 */
public DeployResult publish(Artifact descriptor, List<File> toPublish)
    throws DeploymentException {
  String providedExtension = descriptor.getExtension();
  if (!providedExtension.isEmpty()) {
    LOG.warn(
        "Provided extension %s of artifact %s to be published will be ignored. The extensions "
            + "of the provided file(s) will be used",
        providedExtension, descriptor);
  }
  List<Artifact> artifacts = new ArrayList<>(toPublish.size());
  for (File file : toPublish) {
    artifacts.add(
        new SubArtifact(
            descriptor,
            descriptor.getClassifier(),
            Files.getFileExtension(file.getAbsolutePath()),
            file));
  }
  return publish(artifacts);
}
 
开发者ID:facebook,项目名称:buck,代码行数:28,代码来源:Publisher.java


示例2: deploy

import org.eclipse.aether.util.artifact.SubArtifact; //导入依赖的package包/类
@Override
public void deploy(Rugs operationsAndHandlers, ArtifactSource source,
        ArtifactDescriptor artifact, File root, String clientId) throws IOException {

    String zipFileName = artifact.artifact() + "-" + artifact.version() + "."
            + artifact.extension().toString().toLowerCase();
    File archive = new File(root, ".atomist/target/" + zipFileName);

    Manifest manifest = ManifestFactory.read(source);
    manifest.setGroup(artifact.group());
    manifest.setArtifact(artifact.artifact());
    manifest.setVersion(artifact.version());
    source = generateMetadata(operationsAndHandlers, artifact, source, manifest, clientId);

    writeArtifactSourceToZip(archive, source);
    File pomFile = writePom(manifest, artifact, root);
    File metadataFile = writeMetadataFile(source, artifact, root);

    RepositorySystem system = new MavenConfiguration().repositorySystem();
    RepositorySystemSession session = createRepositorySession();

    Artifact zip = new DefaultArtifact(manifest.group(), manifest.artifact(), "",
            artifact.extension().toString().toLowerCase(), manifest.version());
    zip = zip.setFile(archive);

    Artifact pom = new SubArtifact(zip, "", "pom");
    pom = pom.setFile(pomFile);
    Artifact metadata = new SubArtifact(zip, "metadata", "json");
    metadata = metadata.setFile(metadataFile);

    doWithRepositorySession(system, session, source, manifest, zip, pom, metadata);
}
 
开发者ID:atomist-attic,项目名称:rug-resolver,代码行数:33,代码来源:AbstractMavenBasedDeployer.java


示例3: installBundleWithJar

import org.eclipse.aether.util.artifact.SubArtifact; //导入依赖的package包/类
public void installBundleWithJar(Artifact pomArtifact, Artifact bundleArtifact,
        List<? extends Class<?>> containedClasses) throws IOException, RepositoryException {
    Path jarFile = tempDir.resolve(pomArtifact.getArtifactId() + '-' + pomArtifact.getVersion() + ".jar");
    createDummyJar(jarFile, containedClasses);

    Artifact jarArtifact = new SubArtifact(pomArtifact, "", "jar", jarFile.toFile());
    InstallRequest installRequest = new InstallRequest()
        .addArtifact(pomArtifact)
        .addArtifact(bundleArtifact)
        .addArtifact(jarArtifact);
    repositorySystem.install(repositorySystemSession, installRequest);
}
 
开发者ID:cloudkeeper-project,项目名称:cloudkeeper,代码行数:13,代码来源:DummyAetherRepository.java


示例4: testMvn1

import org.eclipse.aether.util.artifact.SubArtifact; //导入依赖的package包/类
@Test
public void testMvn1 () throws Exception
{
    final ChannelTester ct = ChannelTester.create ( getWebContext (), "m1" );
    ct.addAspect ( "mvn" );
    ct.addAspect ( "maven.repo" );
    ct.assignDeployGroup ( "m1" );

    final String key = ct.getDeployKeys ().iterator ().next (); // get first

    assertNotNull ( key );

    final RepositorySystem system = MavenUtil.newRepositorySystem ();
    final RepositorySystemSession session = MavenUtil.newRepositorySystemSession ( system );

    Artifact jarArtifact = new DefaultArtifact ( "org.eclipse.packagedrone.testing", "test.felix1", "", "jar", "0.0.1-SNAPSHOT" );
    jarArtifact = jarArtifact.setFile ( new File ( TEST_1_JAR ) );

    Artifact pomArtifact = new SubArtifact ( jarArtifact, "", "pom" );
    pomArtifact = pomArtifact.setFile ( new File ( TEST_1_POM ) );

    Artifact srcArtifact = new SubArtifact ( jarArtifact, "sources", "jar" );
    srcArtifact = srcArtifact.setFile ( new File ( TEST_1_SOURCES_JAR ) );

    final AuthenticationBuilder ab = new AuthenticationBuilder ();
    ab.addUsername ( "deploy" );
    ab.addPassword ( key );
    final Authentication auth = ab.build ();
    final RemoteRepository distRepo = new RemoteRepository.Builder ( "test", "default", resolve ( String.format ( "/maven/%s", ct.getId () ) ) ).setAuthentication ( auth ).build ();

    final DeployRequest deployRequest = new DeployRequest ();
    deployRequest.addArtifact ( jarArtifact ).addArtifact ( pomArtifact ).addArtifact ( srcArtifact );
    deployRequest.setRepository ( distRepo );

    system.deploy ( session, deployRequest );

    testUrl ( String.format ( "/maven/%s", ct.getId () ) ); // index page

    // FIXME: check more data
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:41,代码来源:MavenTest.java


示例5: testMvn1

import org.eclipse.aether.util.artifact.SubArtifact; //导入依赖的package包/类
@Test
public void testMvn1 () throws Exception
{
    final ChannelTester ct = ChannelTester.create ( getWebContext (), "m1" );
    ct.addAspect ( "mvn" );
    ct.addAspect ( "maven.repo" );
    ct.assignDeployGroup ( "m1" );

    final String key = ct.getDeployKeys ().iterator ().next (); // get first

    assertNotNull ( key );

    final RepositorySystem system = MavenUtil.newRepositorySystem ();
    final RepositorySystemSession session = MavenUtil.newRepositorySystemSession ( system );

    Artifact jarArtifact = new DefaultArtifact ( "de.dentrassi", "test.bundle1", "", "jar", "1.0.0-SNAPSHOT" );
    jarArtifact = jarArtifact.setFile ( new File ( "data/mvn/test.bundle1-1.0.0-SNAPSHOT.jar" ) );

    Artifact pomArtifact = new SubArtifact ( jarArtifact, "", "pom" );
    pomArtifact = pomArtifact.setFile ( new File ( "data/mvn/test.bundle1-1.0.0-SNAPSHOT.pom" ) );

    Artifact srcArtifact = new SubArtifact ( jarArtifact, "sources", "jar" );
    srcArtifact = srcArtifact.setFile ( new File ( "data/mvn/test.bundle1-1.0.0-SNAPSHOT-sources.jar" ) );

    final AuthenticationBuilder ab = new AuthenticationBuilder ();
    ab.addUsername ( "deploy" );
    ab.addPassword ( key );
    final Authentication auth = ab.build ();
    final RemoteRepository distRepo = new RemoteRepository.Builder ( "test", "default", resolve ( String.format ( "/maven/%s", ct.getId () ) ) ).setAuthentication ( auth ).build ();

    final DeployRequest deployRequest = new DeployRequest ();
    deployRequest.addArtifact ( jarArtifact ).addArtifact ( pomArtifact ).addArtifact ( srcArtifact );
    deployRequest.setRepository ( distRepo );

    system.deploy ( session, deployRequest );

    testUrl ( String.format ( "/maven/%s", ct.getId () ) ); // index page

    // FIXME: check more data
}
 
开发者ID:ctron,项目名称:package-drone,代码行数:41,代码来源:MavenTest.java


示例6: installArtifact

import org.eclipse.aether.util.artifact.SubArtifact; //导入依赖的package包/类
public void installArtifact(String groupId, String artifactId, String ext, String classifier, String version, File artifactFile, File pomFile) throws Exception {
  Artifact jarArtifact = new DefaultArtifact(groupId, artifactId, classifier, ext, version);
  jarArtifact = jarArtifact.setFile(artifactFile);
  Artifact pomArtifact = new SubArtifact(jarArtifact, "", "pom");
  pomArtifact = pomArtifact.setFile(pomFile);
  InstallRequest installRequest = new InstallRequest();
  installRequest.addArtifact(jarArtifact ).addArtifact( pomArtifact );
  InstallResult result = system.install(session, installRequest);
  if (!result.getArtifacts().contains(jarArtifact)) {
    throw new AssertionError("Could not install jar " + jarArtifact);
  }
  if (!result.getArtifacts().contains(pomArtifact)) {
    throw new AssertionError("Could not install pom " + jarArtifact);
  }
}
 
开发者ID:vert-x3,项目名称:vertx-maven-service-factory,代码行数:16,代码来源:AetherHelper.java


示例7: downloadSources

import org.eclipse.aether.util.artifact.SubArtifact; //导入依赖的package包/类
private void downloadSources(Artifact artifact, Path project, Prebuilt library)
    throws IOException {
  Artifact srcs = new SubArtifact(artifact, "sources", "jar");
  try {
    Path relativePath = resolveArtifact(srcs, project);
    library.setSourceJar(relativePath);
  } catch (ArtifactResolutionException e) {
    System.err.println("Skipping sources for: " + srcs);
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:11,代码来源:Resolver.java


示例8: installBundle

import org.eclipse.aether.util.artifact.SubArtifact; //导入依赖的package包/类
/**
 * Installs an Aether artifact representing a CloudKeeper bundle with the given declarations.
 *
 * <p>The group id of artifacts installed with this method is always {@link #GROUP_ID}. Likewise, the version is
 * always {@link #VERSION}.
 *
 * @param artifactId artifact id for new Aether artifact
 * @param declarationClasses DSL classes of plugin declarations that the new bundle will consist of
 * @param dependencies Artifact ids of CloudKeeper bundle dependencies (previously installed with this
 *     method). Group id and version are always assumed to be {@link #GROUP_ID} and {@link #VERSION}, respectively.
 * @throws IOException if an I/O exception occurs
 * @throws LinkerException if the new CloudKeeper bundle cannot be linked with the specified dependencies
 * @throws RepositoryException if an Aether operation (such as retrieving dependencies or installing the new
 *     artifact) fails
 */
public void installBundle(String artifactId, List<? extends Class<?>> declarationClasses,
        String... dependencies) throws IOException, LinkerException, RepositoryException {
    Objects.requireNonNull(declarationClasses);
    Objects.requireNonNull(artifactId);
    Objects.requireNonNull(dependencies);

    List<String> dependenciesList = Arrays.asList(dependencies);
    Map<Name, MutablePackage> packageMap = new LinkedHashMap<>();
    ModuleFactory moduleFactory = ModuleFactory.getDefault();
    for (Class<?> declarationClass: declarationClasses) {
        getOrCreatePackage(declarationClass.getPackage(), packageMap)
            .getDeclarations()
            .add(moduleFactory.loadDeclaration(declarationClass));
    }
    MutableBundle unverifiedBundle = new MutableBundle()
        .setBundleIdentifier(
            Bundles.bundleIdentifierFromMaven(GROUP_ID, artifactId, VERSION))
        .setCreationTime(new Date())
        .setCloudKeeperVersion(BuildInformation.PROJECT_VERSION)
        .setPackages(new ArrayList<>(packageMap.values()));
    try {
        Marshaller marshaller = jaxbContext.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);

        // Verify that bundle can be linked
        List<MutableBundle> dependencyBundles = loadDependencyDeclarations(dependenciesList);
        List<MutableBundle> bundles = new ArrayList<>(1 + dependencyBundles.size());
        bundles.add(unverifiedBundle);
        bundles.addAll(dependencyBundles);
        LinkerOptions linkerOptions = new LinkerOptions.Builder()
            .setMarshalValues(true)
            .build();
        RuntimeRepository repository = Linker.createRepository(bundles, linkerOptions);
        MutableBundle verifiedBundle = MutableBundle.copyOf(repository.getBundles().get(0));

        Path bundleFile = tempDir.resolve(artifactId + '-' + VERSION + ".ckbundle");
        marshaller.marshal(verifiedBundle, bundleFile.toFile());

        Path pomFile = tempDir.resolve(artifactId + '-' + VERSION + ".pom");
        generatePOM(pomFile, GROUP_ID, artifactId, dependenciesList);
        Artifact pomArtifact = new DefaultArtifact(
            GROUP_ID, artifactId, "", "pom", VERSION.toString(), null, pomFile.toFile()
        );
        Artifact bundleArtifact = new SubArtifact(pomArtifact, "", "ckbundle", bundleFile.toFile());

        installBundleWithJar(pomArtifact, bundleArtifact, declarationClasses);
    } catch (JAXBException | XMLStreamException exception) {
        throw new IllegalStateException("Unexpected exception!", exception);
    }
}
 
开发者ID:cloudkeeper-project,项目名称:cloudkeeper,代码行数:66,代码来源:DummyAetherRepository.java


示例9: deployArtifact

import org.eclipse.aether.util.artifact.SubArtifact; //导入依赖的package包/类
private void deployArtifact(final GAV gav,
                            final String pomXML,
                            final File jarFile,
                            final boolean includeAdditionalRepositories) {
    //Write pom.xml to temporary file for deployment
    final File pomXMLFile = new File(System.getProperty("java.io.tmpdir"),
                                     toFileName(gav,
                                                "pom.xml"));

    try {

        writeStringIntoFile(pomXML,
                            pomXMLFile);

        //JAR Artifact
        Artifact jarArtifact = new DefaultArtifact(gav.getGroupId(),
                                                   gav.getArtifactId(),
                                                   "jar",
                                                   gav.getVersion());
        jarArtifact = jarArtifact.setFile(jarFile);

        //pom.xml Artifact
        Artifact pomXMLArtifact = new SubArtifact(jarArtifact,
                                                  "",
                                                  "pom");
        pomXMLArtifact = pomXMLArtifact.setFile(pomXMLFile);

        final Artifact finalJarArtifact = jarArtifact;
        final Artifact finalPomXMLArtifact = pomXMLArtifact;
        this.repositories.forEach((repository) -> repository.deploy(pomXML,
                                                                    finalJarArtifact,
                                                                    finalPomXMLArtifact));

        //Only deploy to additional repositories if required. This flag is principally for Unit Tests
        if (!includeAdditionalRepositories) {
            return;
        }
    } finally {
        try {
            pomXMLFile.delete();
        } catch (Exception e) {
            log.warn("Unable to remove temporary file '" + pomXMLFile.getAbsolutePath() + "'");
        }
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:46,代码来源:GuvnorM2Repository.java


示例10: attach

import org.eclipse.aether.util.artifact.SubArtifact; //导入依赖的package包/类
/**
 * Convenience method for attaching {@link SubArtifact SubArtifacts} to this Artifact.
 * @param file
 * @param classifier
 */
public void attach(File file, String classifier) {
	subs.add(new SubArtifact(this, classifier, FilenameUtils.getExtension(file.getName()), file));
}
 
开发者ID:isomorphic-software,项目名称:isc-maven-plugin,代码行数:9,代码来源:Module.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RunResult类代码示例发布时间:2022-05-22
下一篇:
Java GetTaskReportResponseProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap