Java Code Examples for org.wildfly.swarm.tools.ArtifactSpec#groupId()

The following examples show how to use org.wildfly.swarm.tools.ArtifactSpec#groupId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MavenArtifactResolvingHelper.java    From thorntail with Apache License 2.0 6 votes vote down vote up
@Override
public ArtifactSpec resolve(ArtifactSpec spec) {
    if (spec.file == null) {
        final DefaultArtifact artifact = new DefaultArtifact(spec.groupId(), spec.artifactId(), spec.classifier(),
                typeToExtension(spec.type()), spec.version(), new DefaultArtifactType(spec.type()));

        final LocalArtifactResult localResult = this.session.getLocalRepositoryManager()
                .find(this.session, new LocalArtifactRequest(artifact, this.remoteRepositories, null));
        if (localResult.isAvailable()) {
            spec.file = localResult.getFile();
        } else {
            try {
                final ArtifactResult result = resolver.resolveArtifact(this.session,
                        new ArtifactRequest(artifact, this.remoteRepositories, null));
                if (result.isResolved()) {
                    spec.file = result.getArtifact().getFile();
                }
            } catch (ArtifactResolutionException e) {
                e.printStackTrace();
            }
        }
    }

    return spec.file != null ? spec : null;
}
 
Example 2
Source File: MavenArtifactResolvingHelper.java    From wildfly-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public ArtifactSpec resolve(ArtifactSpec spec) {
    if (spec.file == null) {
        final DefaultArtifact artifact = new DefaultArtifact(spec.groupId(), spec.artifactId(), spec.classifier(),
                spec.type(), spec.version());

        final LocalArtifactResult localResult = this.session.getLocalRepositoryManager()
                .find(this.session, new LocalArtifactRequest(artifact, this.remoteRepositories, null));
        if (localResult.isAvailable()) {
            spec.file = localResult.getFile();
        } else {
            try {
                final ArtifactResult result = resolver.resolveArtifact(this.session,
                        new ArtifactRequest(artifact,
                                this.remoteRepositories,
                                null));
                if (result.isResolved()) {
                    spec.file = result.getArtifact().getFile();
                }
            } catch (ArtifactResolutionException e) {
                System.err.println("ERR " + e);
                e.printStackTrace();
            }
        }
    }

    return spec.file != null ? spec : null;

}
 
Example 3
Source File: DefaultDependencyDescriptor.java    From thorntail with Apache License 2.0 5 votes vote down vote up
/**
 * Construct a new instance of {@code DefaultDependencyDescriptor} from the given {@link ArtifactSpec} reference.
 */
public DefaultDependencyDescriptor(ArtifactSpec spec) {
    this.scope = spec.scope;
    this.groupId = spec.groupId();
    this.artifactId = spec.artifactId();
    this.version = spec.version();
    this.type = spec.type();
    this.classifier = spec.classifier();
    this.file = spec.file;
    this.spec = spec;
}
 
Example 4
Source File: MavenArtifactResolvingHelper.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public ArtifactSpec resolve(ArtifactSpec spec) {
    if (spec.file == null) {
        final DefaultArtifact artifact = new DefaultArtifact(spec.groupId(), spec.artifactId(), spec.classifier(),
                spec.type(), spec.version());

        final LocalArtifactResult localResult = this.session.getLocalRepositoryManager()
                .find(this.session, new LocalArtifactRequest(artifact, this.remoteRepositories, null));
        if (localResult.isAvailable()) {
            spec.file = localResult.getFile();
        } else {
            try {
                final ArtifactResult result = resolver.resolveArtifact(this.session,
                        new ArtifactRequest(artifact,
                                this.remoteRepositories,
                                null));
                if (result.isResolved()) {
                    spec.file = result.getArtifact().getFile();
                }
            } catch (ArtifactResolutionException e) {
                System.err.println("ERR " + e);
                e.printStackTrace();
            }
        }
    }

    return spec.file != null ? spec : null;

}
 
Example 5
Source File: CachingArtifactResolvingHelper.java    From thorntail with Apache License 2.0 4 votes vote down vote up
private DefaultArtifact artifact(ArtifactSpec spec) {
    String type = spec.type();
    type = "bundle".equals(type) ? "jar" : type;
    return new DefaultArtifact(spec.groupId(), spec.artifactId(), spec.classifier(),
            type, spec.version());
}