本文整理汇总了Java中org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate类的典型用法代码示例。如果您正苦于以下问题:Java MavenCoordinate类的具体用法?Java MavenCoordinate怎么用?Java MavenCoordinate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MavenCoordinate类属于org.jboss.shrinkwrap.resolver.api.maven.coordinate包,在下文中一共展示了MavenCoordinate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveAll
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
@Override
public Set<ArtifactSpec> resolveAll(final Set<ArtifactSpec> specs) {
if (specs.isEmpty()) {
return specs;
}
resetListeners();
final MavenResolvedArtifact[] artifacts =
withResolver(r -> r.resolve(specs.stream().map(ArtifactSpec::mavenGav).collect(Collectors.toList()))
.withTransitivity()
.as(MavenResolvedArtifact.class));
return Arrays.stream(artifacts).map(artifact -> {
final MavenCoordinate coord = artifact.getCoordinate();
return new ArtifactSpec("compile",
coord.getGroupId(),
coord.getArtifactId(),
coord.getVersion(),
coord.getPackaging().getId(),
coord.getClassifier(),
artifact.asFile());
}).collect(Collectors.toSet());
}
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:25,代码来源:ShrinkwrapArtifactResolvingHelper.java
示例2: getMainDownloadInfo
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
public SuperStringPair getMainDownloadInfo() {
List<StringPair> ls = Lists.newArrayList();
StringPair spair;
String version;
String urlBase = repo.getUrl();
MavenCoordinate mc = resolvedArtifactMain.getCoordinate();
version = resolvedArtifactMain.getResolvedVersion();
spair = new StringPair("main", EntryPoint.getArtifactUrl(urlBase, resolvedArtifactMain));
for (MavenResolvedArtifact ra : resolvedArtifactClassifiers) {
mc = ra.getCoordinate();
String id = mc.getType().getExtension();
if(mc.getClassifier() !=null && !mc.getClassifier().isEmpty()) {
id = mc.getClassifier();
}
ls.add(new StringPair(id, EntryPoint.getArtifactUrl(urlBase, ra)));
}
return new SuperStringPair(version, spair, ls);
}
示例3: getAdditionalFilters
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
@Override
protected Collection<ArtifactsFilter> getAdditionalFilters() {
Collection<MavenDependency> dependencies = new HashSet<>();
if(StringUtils.isNotBlank(blackListedBoms)){
addCustomBoms(dependencies);
} else {
addDefaultBOMs(dependencies);
}
if(StringUtils.isNotBlank(blackListedGAVs)){
addCustomGAVs(dependencies);
} else {
addDefaultGAVs(dependencies);
}
if(getLog().isDebugEnabled()){
getLog().debug("Filtering out dependencies from the following BOMs: " + bomsUsed);
getLog().debug("Dependencies to be filtered out:");
dependencies.stream().sorted(Comparator.comparing(MavenCoordinate::toCanonicalForm)).forEach(mavenDependency -> getLog().debug(mavenDependency.toCanonicalForm()));
}
List<ArtifactsFilter> filters = new ArrayList<>(dependencies.size());
for(MavenCoordinate dep : dependencies){
filters.add(newExcludeFilter(dep));
}
return filters;
}
示例4: resolveAll
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
@Override
public Set<ArtifactSpec> resolveAll(final Collection<ArtifactSpec> specs, boolean transitive, boolean defaultExcludes) {
if (specs.isEmpty()) {
return Collections.emptySet();
}
MavenResolutionStrategy transitivityStrategy = (transitive ? TransitiveStrategy.INSTANCE : NonTransitiveStrategy.INSTANCE);
resetListeners();
final MavenResolvedArtifact[] artifacts =
withResolver(r -> {
specs.forEach(spec -> r.addDependency(createMavenDependency(spec)));
return r.resolve()
.using(transitivityStrategy)
.as(MavenResolvedArtifact.class);
});
return Arrays.stream(artifacts).map(artifact -> {
final MavenCoordinate coord = artifact.getCoordinate();
return new ArtifactSpec(artifact.getScope().toString(),
coord.getGroupId(),
coord.getArtifactId(),
coord.getVersion(),
coord.getPackaging().getId(),
coord.getClassifier(),
artifact.asFile());
}).collect(Collectors.toSet());
}
示例5: createMavenDependency
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
public MavenDependency createMavenDependency(final ArtifactSpec spec) {
final MavenCoordinate newCoordinate = MavenCoordinates.createCoordinate(
spec.groupId(),
spec.artifactId(),
spec.version(),
PackagingType.of(spec.type()),
spec.classifier());
return MavenDependencies.createDependency(newCoordinate, ScopeType.fromScopeType(spec.scope), false);
}
示例6: getAdditionalFilters
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
@Override
protected Collection getAdditionalFilters() {
Collection<MavenDependency> dependencies = new HashSet<>();
if(StringUtils.isNotBlank(blackListedBoms)){
addCustomBoms(dependencies);
} else {
addDefaultBOMs(dependencies);
}
if(StringUtils.isNotBlank(blackListedGAVs)){
addCustomGAVs(dependencies);
} else {
addDefaultGAVs(dependencies);
}
if(getLog().isDebugEnabled()){
getLog().debug("Filtering out dependencies from the following BOMs: " + bomsUsed);
getLog().debug("Dependencies to be filtered out:");
dependencies.stream().sorted(Comparator.comparing(MavenCoordinate::toCanonicalForm)).forEach(mavenDependency -> getLog().debug(mavenDependency.toCanonicalForm()));
}
List<ArtifactsFilter> filters = new ArrayList<>(dependencies.size());
for(MavenCoordinate dep : dependencies){
filters.add(newExcludeFilter(dep));
}
return filters;
}
示例7: getLatestVersion
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
private static String getLatestVersion(
String groupId, String artifactId, String minVersion, DeployableType type) {
LOG.debug("Looking for version: {}/{}", groupId, artifactId);
String searchVersion = String.format("(%s,)", minVersion);
MavenVersionRangeResult versionRangeResult =
getResolver().resolveVersionRange(formatMavenId(groupId, artifactId, searchVersion, type));
if (!versionRangeResult.getHighestVersion().getVersion().contains(SNAPSHOT)) {
return versionRangeResult.getHighestVersion().getVersion();
}
Map<Semver, MavenCoordinate> versionMap = new HashMap<>();
versionRangeResult
.getVersions()
.stream()
.forEach(
c -> {
versionMap.put(new Semver(c.getVersion(), SemverType.LOOSE), c);
});
Semver version =
versionMap
.keySet()
.stream()
.filter(v -> !v.getOriginalValue().contains(SNAPSHOT))
.max(ORDER)
.get();
LOG.debug("Found version: {}/{} -> {}", groupId, artifactId, version);
return versionMap.get(version).getVersion();
}
示例8: getArtifactUrl
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
public static String getArtifactUrl(String url, MavenResolvedArtifact artifact) {
String resolved = artifact.getResolvedVersion();
MavenCoordinate mc = artifact.getCoordinate();
if (mc.getClassifier() == null || mc.getClassifier().equals("")) {
return url + mc.getGroupId().replace(".", "/") + "/" + mc.getArtifactId().replace(".", "/") + "/" + mc.getVersion() + "/" + mc
.getArtifactId() + "-" + resolved
+ "." + mc.getPackaging().getExtension();
} else {
return url + mc.getGroupId().replace(".", "/") + "/" + mc.getArtifactId().replace(".", "/") + "/" + mc.getVersion() + "/" + mc
.getArtifactId() + "-" + resolved
+ "-" + mc.getClassifier()
+ "." + mc.getPackaging().getExtension();
}
}
示例9: fetchFromMavenRepository
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
private File fetchFromMavenRepository(ExecutorService executor) {
final MavenCoordinate distributableCoordinate = toMavenCoordinate(targetAdapter.distribution());
if (distributableCoordinate != null) {
final File targetDirectory = new File(new File(distributionDownloadFolder, "server"),
distributableCoordinate.getArtifactId() + "_" + distributableCoordinate.getVersion());
if (serverAlreadyDownloaded(targetDirectory)) {
return getDistributionHome(targetDirectory);
}
System.out.println(
"Arquillian Chameleon: downloading distribution " + distributableCoordinate.toCanonicalForm());
Future<File> uncompressDirectory = executor.submit(new Callable<File>() {
@Override
public File call() throws Exception {
return Maven.resolver().resolve(distributableCoordinate.toCanonicalForm())
.withoutTransitivity()
.asSingle(GenericArchive.class)
.as(ExplodedExporter.class)
.exportExploded(targetDirectory, ".");
}
});
try {
while (!uncompressDirectory.isDone()) {
System.out.print(PROGRESS_INDICATOR);
Thread.sleep(HALF_A_SECOND);
}
System.out.println();
return getDistributionHome(uncompressDirectory.get());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return null;
}
示例10: isArtifactEjb
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
/**
* Sprawdza czy dany artefakt jest ejb (ale nie jest ejb-clientem). Artefakt w formie MavenCoordinate.
*
* FIXME: Z powodu bledu shrinkwrapa szukamy tak na lewo po nazwie.
*
* @param artifactCoordinate MavenCoordinate artefaktu do sprawdzenia
* @return true jesli jest projektem ejb
*/
private static boolean isArtifactEjb(MavenCoordinate artifactCoordinate) {
if ("client".equals(artifactCoordinate.getClassifier())) {
return false;
}
if (!artifactCoordinate.getGroupId().startsWith("pl.gov.coi")) {
return false;
}
if (!artifactCoordinate.getArtifactId().toLowerCase().contains("ejb")) {
return false;
}
return true;
}
示例11: isFiltered
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
/**
* Check if artefact should be filtered (omitted from packaging).
* <p>
* By default all artefact witch groups start with org.jboss.(shrinkwrap|arqrquillian) are filtered.
* </p>
* @param artifactCoordinate Artifact coordinate to check
* @return true if artifact should be filtered
*/
private static boolean isFiltered(MavenCoordinate artifactCoordinate) {
if (artifactCoordinate.getGroupId().startsWith("org.jboss.shrinkwrap")) {
return true;
}
if (artifactCoordinate.getGroupId().startsWith("org.jboss.arquillian")) {
return true;
}
if (artifactCoordinate.getGroupId().startsWith("org.jboss.as")) {
return true;
}
return false;
}
示例12: newMavenDependency
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
protected MavenDependency newMavenDependency(String gav) {
MavenCoordinate coordinate = MavenCoordinates.createCoordinate(gav.trim());
return MavenDependencies.createDependency(coordinate, ScopeType.COMPILE, false );
}
示例13: newExcludeFilter
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
protected ExcludeFilter newExcludeFilter(MavenCoordinate dep) {
Exclude exclude = new Exclude();
exclude.setGroupId(dep.getGroupId());
exclude.setArtifactId(dep.getArtifactId());
return new ExcludeFilter(exclude);
}
示例14: loadDefaultProject
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
@PostConstruct
public void loadDefaultProject() throws Exception {
String defaultProjectHome = System.getProperty(Application.PROJECT_HOME, System.getenv(Application.PROJECT_HOME_ENV));
if (project == null && StringUtils.hasText(defaultProjectHome)) {
load(defaultProjectHome);
}
String repositoryUrl = System.getProperty(Application.PROJECT_REPOSITORY, System.getenv(Application.PROJECT_REPOSITORY_ENV));
if (project == null && StringUtils.hasText(repositoryUrl)) {
Repository repository;
String vcs = System.getProperty(Application.PROJECT_VERSION_CONTROL, Optional.ofNullable(System.getenv(Application.PROJECT_VERSION_CONTROL_ENV)).orElse(Repository.VERSION_CONTROL_GIT));
if (vcs.equalsIgnoreCase(Repository.VERSION_CONTROL_GIT)) {
repository = new GitRepository();
} else if (vcs.equalsIgnoreCase(Repository.VERSION_CONTROL_SVN)) {
repository = new SvnRepository();
} else {
throw new ApplicationRuntimeException(String.format("Unsupported version control system '%s'", vcs));
}
repository.setUrl(repositoryUrl);
repository.setBranch(System.getProperty(Application.PROJECT_REPOSITORY_BRANCH,
System.getenv(Application.PROJECT_REPOSITORY_BRANCH_ENV) != null ? System.getenv(Application.PROJECT_REPOSITORY_BRANCH_ENV) : repository.getBranch()));
repository.setModule(System.getProperty(Application.PROJECT_REPOSITORY_MODULE,
System.getenv(Application.PROJECT_REPOSITORY_MODULE_ENV) != null ? System.getenv(Application.PROJECT_REPOSITORY_MODULE_ENV) : repository.getModule()));
repository.setUsername(System.getProperty(Application.PROJECT_REPOSITORY_USERNAME, System.getenv(Application.PROJECT_REPOSITORY_USERNAME_ENV)));
repository.setPassword(System.getProperty(Application.PROJECT_REPOSITORY_PASSWORD, System.getenv(Application.PROJECT_REPOSITORY_PASSWORD_ENV)));
create(repository);
}
String mavenArchetype = System.getProperty(Application.MAVEN_ARCHETYPE_COORDINATES, System.getenv(Application.MAVEN_ARCHETYPE_COORDINATES_ENV));
if (project == null && StringUtils.hasText(mavenArchetype)) {
MavenArchetype archetype = new MavenArchetype();
MavenCoordinate archetypeCoordinates = MavenCoordinates.createCoordinate(mavenArchetype);
archetype.setArchetypeGroupId(archetypeCoordinates.getGroupId());
archetype.setArchetypeArtifactId(archetypeCoordinates.getArtifactId());
archetype.setArchetypeVersion(archetypeCoordinates.getVersion());
String mavenProject = System.getProperty(Application.MAVEN_PROJECT_COORDINATES,
System.getenv(Application.MAVEN_PROJECT_COORDINATES_ENV) != null ? System.getenv(Application.MAVEN_PROJECT_COORDINATES_ENV) : "com.consol.citrus:citrus-project:1.0.0");
MavenCoordinate projectCoordinates = MavenCoordinates.createCoordinate(mavenProject);
archetype.setGroupId(projectCoordinates.getGroupId());
archetype.setArtifactId(projectCoordinates.getArtifactId());
archetype.setVersion(projectCoordinates.getVersion());
archetype.setPackageName(System.getProperty(Application.MAVEN_PROJECT_PACKAGE,
System.getenv(Application.MAVEN_PROJECT_PACKAGE_ENV) != null ? System.getenv(Application.MAVEN_PROJECT_PACKAGE_ENV) : projectCoordinates.getGroupId()));
create(archetype);
}
}
示例15: resolve
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; //导入依赖的package包/类
private JavaArchive resolve(String coordinate, ConfigurableMavenResolverSystem maven) {
final MavenCoordinate highestVersion = maven.resolveVersionRange(coordinate).getHighestVersion();
return maven.resolve(highestVersion.toCanonicalForm()).withoutTransitivity().asSingle(JavaArchive.class);
}