for (final String coordinate : hadoopDependencyCoordinates) { final DefaultArtifact artifact = new DefaultArtifact(coordinate); final File hadoopDependencyDir = new File(rootHadoopDependenciesDir, artifact.getArtifactId()); final File versionDir = new File(hadoopDependencyDir, artifact.getVersion());
public String defaultName() { return artifact.getArtifactId(); }
@Override public List<String> faultProjects() { List<String> result; DefaultArtifact artifact; result = new ArrayList<>(); for (Application application : applications.applications()) { if (application.location instanceof GavLocator) { artifact = ((GavLocator) application.location).artifact(); result.add("gav:" + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion()); } else { session.console.error.println("don't know fault project for locator " + application.location + " - working without secrets for this"); result.add("@-"); } } return result; }
for (final String coordinate : hadoopDependencyCoordinates) { final DefaultArtifact artifact = new DefaultArtifact(coordinate); final File hadoopDependencyDir = new File(rootHadoopDependenciesDir, artifact.getArtifactId()); final File versionDir = new File(hadoopDependencyDir, artifact.getVersion());
for (final String coordinate : hadoopDependencyCoordinates) { final DefaultArtifact artifact = new DefaultArtifact(coordinate); final File hadoopDependencyDir = new File(rootHadoopDependenciesDir, artifact.getArtifactId()); final File versionDir = new File(hadoopDependencyDir, artifact.getVersion());
private static boolean isParentBom(Model model, DefaultArtifact artifact) { if (model.getParent() == null) { return false; } if (ObjectUtils.nullSafeEquals(artifact.getArtifactId(), model.getParent().getArtifactId()) && ObjectUtils.nullSafeEquals(artifact.getGroupId(), model.getParent().getGroupId())) { return true; } if (ObjectUtils.nullSafeEquals("spring-boot-starter-parent", model.getParent().getArtifactId()) && ObjectUtils.nullSafeEquals(artifact.getArtifactId(), "spring-boot-dependencies")) { return true; } return false; }
Map.Entry<String,PluginMetadata> entry = it.next(); DefaultArtifact artifact = entry.getValue().getDefaultArtifact(); File artifactDir = new File(new File(localRepo, artifact.getGroupId().replace('.', File.separatorChar)), artifact.getArtifactId()); File metadata = new File(artifactDir, "maven-metadata-local.xml"); if (metadata.isFile()) { String version = versions.item(i).getTextContent(); if (version.endsWith("-SNAPSHOT") && versionScheme.parseVersion(version).compareTo(ucVersion) > 0) { File hpi = new File(new File(artifactDir, version), artifact.getArtifactId() + "-" + version + ".hpi"); if (hpi.isFile()) { String name = entry.getKey();
DefaultArtifact artifact = new DefaultArtifact(coordinate); Artifact pomArtifact = new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), "pom", artifact.getVersion()); ArtifactRequest request = new ArtifactRequest(pomArtifact, Arrays.asList(aetherSession.getRemoteRepository()), null); pomArtifact = aetherSession.getRepoSystem().resolveArtifact(session, request).getArtifact(); ModelBuilder modelBuilder = new DefaultModelBuilderFactory().newInstance(); ModelBuildingRequest buildingRequest = new DefaultModelBuildingRequest(); buildingRequest.setPomFile(pomArtifact.getFile()); buildingRequest.setProcessPlugins(true); buildingRequest.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL); Constructor<?> constr = Class.forName("org.apache.maven.repository.internal.DefaultModelResolver").getConstructors()[0]; constr.setAccessible(true); ModelResolver modelResolver = (ModelResolver) constr.newInstance(session, null, null, serviceLocator.getService(ArtifactResolver.class), serviceLocator.getService(VersionRangeResolver.class), serviceLocator.getService(RemoteRepositoryManager.class), request.getRepositories()); buildingRequest.setModelResolver(modelResolver); Model model = modelBuilder.build(buildingRequest).getEffectiveModel(); Xpp3Dom pluginConfiguration = (Xpp3Dom) model.getBuild().getPluginsAsMap().get("com.company.group:my-plugin").getConfiguration(); Xpp3Dom myConfig = pluginConfiguration.getChild("myConfig"); System.out.println(myConfig.getChild("somePropName").getValue()); // prints "someProp"
public WarFile resolve() throws IOException { String version; if (artifact.getVersion().equals("@latest")) { try { version = maven.latestRelease(artifact); } catch (VersionRangeResolutionException e) { throw new IOException(e); } artifact = new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), "war", version); } try { return new WarFile(maven.resolve(artifact)); } catch (ArtifactResolutionException e) { throw (IOException) new FileNotFoundException("Artifact " + artifact + " not found: " + e.getMessage()).initCause(e); } }
private static Exclusion exclusion(String pom) { Exclusion exclusion = new Exclusion(); DefaultArtifact artifact = artifact(pom); exclusion.setGroupId(artifact.getGroupId()); exclusion.setArtifactId(artifact.getArtifactId()); return exclusion; }
static Dependency dependency(DefaultArtifact artifact) { Dependency dependency = new Dependency(); dependency.setGroupId(artifact.getGroupId()); dependency.setArtifactId(artifact.getArtifactId()); dependency.setVersion( StringUtils.hasLength(artifact.getVersion()) ? artifact.getVersion() : null); dependency.setClassifier( StringUtils.hasLength(artifact.getClassifier()) ? artifact.getClassifier() : null); dependency.setType(artifact.getExtension()); return dependency; }
for (Dependency dependency : model.getDependencyManagement() .getDependencies()) { if (ObjectUtils.nullSafeEquals(artifact.getArtifactId(), dependency.getArtifactId()) && ObjectUtils.nullSafeEquals(artifact.getGroupId(), boolean replaced = false; for (Dependency dependency : model.getDependencies()) { if (ObjectUtils.nullSafeEquals(artifact.getArtifactId(), dependency.getArtifactId()) && ObjectUtils.nullSafeEquals(artifact.getGroupId(),