public File getFile() { return artifact.getFile(); }
public File getFile() { return artifact.getFile(); }
private static Map<String, String> transformArtifactResultToArtifactToPaths(List<ArtifactResult> artifactResults) { Map<String, String> artifactToPath = new LinkedHashMap<>(); for (ArtifactResult artifactResult : artifactResults) { Artifact artifact = artifactResult.getArtifact(); artifactToPath.put(AetherUtils.artifactToString(artifact), artifact.getFile().getAbsolutePath()); } return artifactToPath; }
@Override public void artifactInstalling( RepositoryEvent event ) { logger.info( "Installing " + event.getArtifact().getFile() + " to " + event.getFile() ); }
private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifact> artifacts ) throws Exception { String realmId = "coreExtension>" + extension.getGroupId() + ":" + extension.getArtifactId() + ":" + extension.getVersion(); ClassRealm realm = classWorld.newRealm( realmId, null ); log.debug( "Populating class realm " + realm.getId() ); realm.setParentRealm( parentRealm ); for ( Artifact artifact : artifacts ) { File file = artifact.getFile(); log.debug( " Included " + file ); realm.addURL( file.toURI().toURL() ); } return CoreExtensionEntry.discoverFrom( realm, Collections.singleton( artifacts.get( 0 ).getFile() ) ); }
public Path findMavenArtifact( final Artifact artifact) throws MavenArtifactNotFoundException { final ArtifactResult result; try { result = this.repositorySystem.resolveArtifact( this.repositorySystemSession, new ArtifactRequest().setArtifact(artifact)); } catch (ArtifactResolutionException ex) { throw new MavenArtifactNotFoundException(artifact, this.givenLocalMavenRepositoryPath, this.absoluteLocalMavenRepositoryPath, ex); } return result.getArtifact().getFile().toPath(); }
return projectArtifact.getFile();
if ( artifact.getFile() != null )
public static org.apache.maven.artifact.Artifact toArtifact( Artifact artifact ) { if ( artifact == null ) { return null; } ArtifactHandler handler = newHandler( artifact ); /* * NOTE: From Artifact.hasClassifier(), an empty string and a null both denote "no classifier". However, some * plugins only check for null, so be sure to nullify an empty classifier. */ org.apache.maven.artifact.Artifact result = new org.apache.maven.artifact.DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), null, artifact.getProperty( ArtifactProperties.TYPE, artifact.getExtension() ), nullify( artifact.getClassifier() ), handler ); result.setFile( artifact.getFile() ); result.setResolved( artifact.getFile() != null ); List<String> trail = new ArrayList<>( 1 ); trail.add( result.getId() ); result.setDependencyTrail( trail ); return result; }
@Override public ModelSource resolveModel( String groupId, String artifactId, String version ) throws UnresolvableModelException { Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version ); try { ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context ); request.setTrace( trace ); pomArtifact = resolver.resolveArtifact( session, request ).getArtifact(); } catch ( ArtifactResolutionException e ) { throw new UnresolvableModelException( e.getMessage(), groupId, artifactId, version, e ); } File pomFile = pomArtifact.getFile(); return new FileModelSource( pomFile ); }
artifact.setFile( result.getArtifact().getFile() ); artifact.setResolved( true );
public ModelSource resolveModel( String groupId, String artifactId, String version ) throws UnresolvableModelException { File pomFile = null; if ( modelPool != null ) { pomFile = modelPool.get( groupId, artifactId, version ); } if ( pomFile == null ) { Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version ); try { ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context ); request.setTrace( trace ); pomArtifact = resolver.resolveArtifact( session, request ).getArtifact(); } catch ( ArtifactResolutionException e ) { throw new UnresolvableModelException( e.getMessage(), groupId, artifactId, version, e ); } pomFile = pomArtifact.getFile(); } return new FileModelSource( pomFile ); }
File pomFile = pomArtifact.getFile();
Collection<Exclusion> exclusions = dependency != null ? dependency.getExclusions() : null; org.eclipse.aether.graph.Dependency dep = RepositoryUtils.toDependency( artifact, exclusions ); if ( !JavaScopes.SYSTEM.equals( dep.getScope() ) && dep.getArtifact().getFile() != null )
public Path getVersionJar(String version) throws ArtifactResolutionException { Artifact versionArtifact = new DefaultArtifact(groupId, artifactId, "jar", version.toString()); ArtifactRequest request = new ArtifactRequest(); request.setArtifact(versionArtifact); request.setRepositories(mavenPluginRepository.getRepositories()); ArtifactResult resolveArtifact = mavenPluginRepository.getSystem().resolveArtifact(mavenPluginRepository.getSession(), request); return resolveArtifact.getArtifact().getFile().toPath(); }
public byte[] getVersionPluginXml(String version) throws ArtifactResolutionException, IOException { // return getJarContent(version, "plugin/plugin.xml"); Artifact versionArtifact = new DefaultArtifact(groupId, artifactId, "plugin", "xml", version.toString()); ArtifactRequest request = new ArtifactRequest(); request.setArtifact(versionArtifact); request.setRepositories(mavenPluginRepository.getRepositories()); ArtifactResult resolveArtifact = mavenPluginRepository.getSystem().resolveArtifact(mavenPluginRepository.getSession(), request); byte[] bytes = FileUtils.readFileToByteArray(resolveArtifact.getArtifact().getFile()); return bytes; }
public byte[] getVersionIcon(String version) throws ArtifactResolutionException, IOException { Artifact versionArtifact = new DefaultArtifact(groupId, artifactId, "icon", "png", version.toString()); ArtifactRequest request = new ArtifactRequest(); request.setArtifact(versionArtifact); request.setRepositories(mavenPluginRepository.getRepositories()); ArtifactResult resolveArtifact = mavenPluginRepository.getSystem().resolveArtifact(mavenPluginRepository.getSession(), request); return FileUtils.readFileToByteArray(resolveArtifact.getArtifact().getFile()); }