public ArtifactHandler getArtifactHandler( String type ) { ArtifactHandler handler = unmanagedHandlers.get( type ); if ( handler == null ) { handler = artifactHandlers.get( type ); if ( handler == null ) { handler = new DefaultArtifactHandler( type ); } } return handler; }
private Artifact getArtifactFromPomProperties(String type, Properties pomProps) { return new DefaultArtifact( pomProps.getProperty("groupId"), pomProps.getProperty("artifactId"), pomProps.getProperty("version"), "runtime", type, pomProps.getProperty("classifier", ""), new DefaultArtifactHandler(type) ); }
public static ArtifactHandler newHandler( Artifact artifact ) { String type = artifact.getProperty( ArtifactProperties.TYPE, artifact.getExtension() ); DefaultArtifactHandler handler = new DefaultArtifactHandler( type ); handler.setExtension( artifact.getExtension() ); handler.setLanguage( artifact.getProperty( ArtifactProperties.LANGUAGE, null ) ); String addedToClasspath = artifact.getProperty( ArtifactProperties.CONSTITUTES_BUILD_PATH, "" ); handler.setAddedToClasspath( Boolean.parseBoolean( addedToClasspath ) ); String includesDependencies = artifact.getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES, "" ); handler.setIncludesDependencies( Boolean.parseBoolean( includesDependencies ) ); return handler; }
/** * Gets the ArtifactHandler for the given type * * @param type the type of the artifact * @return the {@link ArtifactHandler} */ public ArtifactHandler getArtifactHandler(String type) { return new DefaultArtifactHandler(type); }
private Artifact getArtifactFromPomProperties(String type, Properties pomProps) { return new DefaultArtifact( pomProps.getProperty("groupId"), pomProps.getProperty("artifactId"), pomProps.getProperty("version"), "runtime", type, pomProps.getProperty("classifier", ""), new DefaultArtifactHandler(type) ); }
/** * {@inheritDoc} */ public ArtifactHandler getArtifactHandler() { if (handler == null) { handler = new DefaultArtifactHandler(getType()); } return handler; }
public static Artifact resolveArtifactFile(MavenSession session, RepositorySystem repository, String groupId, String artifactId, String version, String type) { final DefaultArtifact artifact = new DefaultArtifact(groupId, artifactId, version, "compile", type, "", new DefaultArtifactHandler(type)); final ArtifactResolutionResult result = resolveArtifact(session, repository, artifact, false, null); for (Artifact a : result.getArtifacts()) { if (a.equals(artifact)) { return a; } } throw new IllegalArgumentException(artifact + " could not be resolved"); }
private static void createArtifacts(List<Dependency> pomDeps, Set<Artifact> deps) { if (pomDeps != null && pomDeps.size() > 0) { for (Dependency dep : pomDeps) { Artifact artifact = new DefaultArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getVersion(), dep.getScope(), dep.getType(), dep.getClassifier(), new DefaultArtifactHandler()); deps.add(artifact); } } }
/** * Build the default artifact file name in a maven repository. * * @param artifact the artifact from which the default file name is going to be resolved. * @return the default artifact file name that a repository resource contains given its type. */ public static String getFormattedFileName(Artifact artifact) { String destFileName = buildMainFileName(artifact); String extension = new DefaultArtifactHandler(artifact.getType()).getExtension(); return destFileName + "." + extension; }
private void attachIfNeeded(File jar) { if (jar.isFile() && classifier != null && attach) { ArtifactHandler handler = new DefaultArtifactHandler("jar"); Artifact vertxJarArtifact = new DefaultArtifact(project.getGroupId(), project.getArtifactId(), project.getVersion(), "compile", "jar", classifier, handler); vertxJarArtifact.setFile(jar); this.project.addAttachedArtifact(vertxJarArtifact); } }
private ArtifactHandler buildArtifactHandler(String type) { DefaultArtifactHandler artifactHandler = new DefaultArtifactHandler( type ); artifactHandler.setLanguage( "java" ); artifactHandler.setAddedToClasspath( true ); return artifactHandler; }
private ArtifactHandler buildArtifactHandler(String type) { DefaultArtifactHandler artifactHandler = new DefaultArtifactHandler( type ); artifactHandler.setLanguage( "java" ); artifactHandler.setAddedToClasspath( true ); return artifactHandler; }
/** * Builds an instance of {@link Artifact}. * * @return the created instance. */ public Artifact build() { if (artifactHandler == null) { withArtifactHandler(new DefaultArtifactHandler()); } return new DefaultArtifact(groupId, artifactId, versionRange, scope, type, classifier, artifactHandler); }
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest(); configuration.setProcessPlugins( false ); configuration.setRepositorySession( session ); org.apache.maven.artifact.Artifact artifact = new org.apache.maven.artifact.DefaultArtifact(groupId, artifactId, version, "compile", "", "", new DefaultArtifactHandler()); MavenProject project = projectBuilder.build(artifact, configuration).getProject();
@Override public org.apache.maven.artifact.Artifact apply(org.eclipse.aether.artifact.Artifact a) { return new DefaultArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion(), "compile", a.getExtension(), a.getClassifier() != null ? a.getClassifier() : null, new DefaultArtifactHandler()); } }
@Override public org.apache.maven.artifact.Artifact apply(org.eclipse.aether.artifact.Artifact a) { return new DefaultArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion(), "compile", a.getExtension(), a.getClassifier() != null ? a.getClassifier() : null, new DefaultArtifactHandler()); } }
private static Artifact createMockArtifact( final String groupId, final String artifactId, final String versionRange, final String scope, final String type, final String classifier ) { ArtifactHandler artifactHandler = new DefaultArtifactHandler(); VersionRange version = VersionRange.createFromVersion( versionRange ); return new DefaultArtifact( groupId, artifactId, version, scope, type, classifier, artifactHandler ); } }
public static ArtifactHandler newHandler(Artifact artifact) { String type = artifact.getProperty(ArtifactProperties.TYPE, artifact.getExtension()); DefaultArtifactHandler handler = new DefaultArtifactHandler(type); handler.setExtension(artifact.getExtension()); handler.setLanguage(artifact.getProperty(ArtifactProperties.LANGUAGE, null)); handler.setAddedToClasspath(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.CONSTITUTES_BUILD_PATH, ""))); handler.setIncludesDependencies(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.INCLUDES_DEPENDENCIES, ""))); return handler; }
public static ArtifactHandler newHandler(Artifact artifact) { String type = artifact.getProperty(ArtifactProperties.TYPE, artifact.getExtension()); DefaultArtifactHandler handler = new DefaultArtifactHandler(type); handler.setExtension(artifact.getExtension()); handler.setLanguage(artifact.getProperty(ArtifactProperties.LANGUAGE, null)); handler.setAddedToClasspath(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.CONSTITUTES_BUILD_PATH, ""))); handler.setIncludesDependencies(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.INCLUDES_DEPENDENCIES, ""))); return handler; }
public static ArtifactResolutionResult resolveArtifact(MavenSession session, RepositorySystem repository, Artifact artifact, boolean transitive, ArtifactFilter resolutionFilter) { artifact.setArtifactHandler(new DefaultArtifactHandler(artifact.getType())); ArtifactResolutionRequest request = new ArtifactResolutionRequest() .setArtifact(artifact) .setResolveRoot(true) .setServers(session.getRequest().getServers()) .setMirrors(session.getRequest().getMirrors()) .setProxies(session.getRequest().getProxies()) .setLocalRepository(session.getLocalRepository()) .setRemoteRepositories(session.getRequest().getRemoteRepositories()) .setResolveTransitively(transitive) .setCollectionFilter(resolutionFilter) .setResolutionFilter(resolutionFilter); //.setListeners(Arrays.<ResolutionListener>asList(new DebugResolutionListener(new ConsoleLogger()))); return repository.resolve(request); }