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; }
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; }
private ArtifactHandler buildArtifactHandler(String type) { DefaultArtifactHandler artifactHandler = new DefaultArtifactHandler( type ); artifactHandler.setLanguage( "java" ); artifactHandler.setAddedToClasspath( true ); return artifactHandler; }
/** * 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 ArtifactHandler buildArtifactHandler(String type) { DefaultArtifactHandler artifactHandler = new DefaultArtifactHandler( type ); artifactHandler.setLanguage( "java" ); artifactHandler.setAddedToClasspath( true ); return artifactHandler; }
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)); handler.setAddedToClasspath(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.CONSTITUTES_BUILD_PATH, ""))); handler.setIncludesDependencies(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.INCLUDES_DEPENDENCIES, ""))); 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); }
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; }
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); } } }
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 ArtifactVersion[] filterVersionsWithIncludes( ArtifactVersion[] newer, Artifact artifact ) { List<ArtifactVersion> filteredNewer = new ArrayList<>( newer.length ); for ( int j = 0; j < newer.length; j++ ) { ArtifactVersion artifactVersion = newer[j]; Artifact artefactWithNewVersion = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), VersionRange.createFromVersion( artifactVersion.toString() ), artifact.getScope(), artifact.getType(), null, new DefaultArtifactHandler(), false ); if ( isIncluded( artefactWithNewVersion ) ) { filteredNewer.add( artifactVersion ); } } return filteredNewer.toArray( new ArtifactVersion[filteredNewer.size()] ); }
private ArtifactVersion[] filterVersionsWithIncludes( ArtifactVersion[] newer, Artifact artifact ) { List<ArtifactVersion> filteredNewer = new ArrayList<>( newer.length ); for ( int j = 0; j < newer.length; j++ ) { ArtifactVersion artifactVersion = newer[j]; Artifact artefactWithNewVersion = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), VersionRange.createFromVersion( artifactVersion.toString() ), artifact.getScope(), artifact.getType(), null, new DefaultArtifactHandler(), false ); if ( isIncluded( artefactWithNewVersion ) ) { filteredNewer.add( artifactVersion ); } } return filteredNewer.toArray( new ArtifactVersion[filteredNewer.size()] ); }
/** * 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();
"type", null, new DefaultArtifactHandler()); a.setFile(cassandraDir); f.set(this, a);
mavenProject.getArtifactId(), mavenProject.getVersion(), "compile", schemaArtifactExtension, schemaArtifactClassifier, new DefaultArtifactHandler(schemaArtifactExtension)); schemas.setFile(avsc.toFile()); logger.debug("Attaching " + schemas + " from " + avsc); new DefaultArtifactHandler("jar")); avroSources.setFile(sources.toFile()); mavenProject.getAttachedArtifacts().add(avroSources);