final DefaultArtifact artifact = new DefaultArtifact(coordinate); final File hadoopDependencyDir = new File(rootHadoopDependenciesDir, artifact.getArtifactId()); final File versionDir = new File(hadoopDependencyDir, artifact.getVersion());
@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; }
final DefaultArtifact artifact = new DefaultArtifact(coordinate); final File hadoopDependencyDir = new File(rootHadoopDependenciesDir, artifact.getArtifactId()); final File versionDir = new File(hadoopDependencyDir, artifact.getVersion());
final DefaultArtifact artifact = new DefaultArtifact(coordinate); final File hadoopDependencyDir = new File(rootHadoopDependenciesDir, artifact.getArtifactId()); final File versionDir = new File(hadoopDependencyDir, artifact.getVersion());
if (metadata.isFile()) { try { Version ucVersion = versionScheme.parseVersion(artifact.getVersion()); NodeList versions = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(metadata).getElementsByTagName("version"); for (int i = 0; i < versions.getLength(); i++) {
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"
analysisResults = new AnalysisResults(ApiChangeLevel.NO_CHANGE, oldArtifact.getVersion()); } else { analysisResults = analyzeProject(project);
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; }
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); } }
&& ObjectUtils.nullSafeEquals(artifact.getGroupId(), dependency.getGroupId())) { dependency.setVersion(artifact.getVersion()); model.getParent().setVersion(artifact.getVersion()); replaced = true; && ObjectUtils.nullSafeEquals(artifact.getClassifier(), dependency.getClassifier()) && artifact.getVersion() != null) { dependency.setVersion( StringUtils.hasLength(artifact.getVersion()) ? artifact.getVersion() : null); dependency.setScope("runtime");
node.setVersion( versionScheme.parseVersion( artifact.getVersion() ) ); node.setVersionConstraint( versionScheme.parseVersionConstraint( def.range != null ? def.range : artifact.getVersion() ) );