protected void mergeDependency_SystemPath( Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getSystemPath(); if ( src != null ) { if ( sourceDominant || target.getSystemPath() == null ) { target.setSystemPath( src ); target.setLocation( "systemPath", source.getLocation( "systemPath" ) ); } } }
public static Dependency toDependency( org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes ) { ArtifactType stereotype = stereotypes.get( dependency.getType() ); if ( stereotype == null ) { stereotype = new DefaultArtifactType( dependency.getType() ); } boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0; Map<String, String> props = null; if ( system ) { props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() ); } Artifact artifact = new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, dependency.getVersion(), props, stereotype ); List<Exclusion> exclusions = new ArrayList<>( dependency.getExclusions().size() ); for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() ) { exclusions.add( toExclusion( exclusion ) ); } Dependency result = new Dependency( artifact, dependency.getScope(), dependency.getOptional() != null ? dependency.isOptional() : null, exclusions ); return result; }
private Dependency convert( org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes ) { ArtifactType stereotype = stereotypes.get( dependency.getType() ); if ( stereotype == null ) { stereotype = new DefaultArtifactType( dependency.getType() ); } boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0; Map<String, String> props = null; if ( system ) { props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() ); } Artifact artifact = new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, dependency.getVersion(), props, stereotype ); List<Exclusion> exclusions = new ArrayList<>( dependency.getExclusions().size() ); for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() ) { exclusions.add( convert( exclusion ) ); } Dependency result = new Dependency( artifact, dependency.getScope(), dependency.getOptional() != null ? dependency.isOptional() : null, exclusions ); return result; }
d.getClassifier(), d.getScope(), d.isOptional() ); if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) && d.getSystemPath() != null ) artifact.setFile( new File( d.getSystemPath() ) );
d.getClassifier(), d.getScope(), d.isOptional() ); if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) && d.getSystemPath() != null ) artifact.setFile( new File( d.getSystemPath() ) );
private static Artifact createDependencyArtifact( ArtifactFactory factory, Dependency dependency, String inheritedScope, ArtifactFilter inheritedFilter ) throws InvalidVersionSpecificationException { String effectiveScope = getEffectiveScope( dependency.getScope(), inheritedScope ); if ( effectiveScope == null ) { return null; } VersionRange versionRange = VersionRange.createFromVersionSpec( dependency.getVersion() ); Artifact dependencyArtifact = factory.createDependencyArtifact( dependency.getGroupId(), dependency.getArtifactId(), versionRange, dependency.getType(), dependency.getClassifier(), effectiveScope, dependency.isOptional() ); ArtifactFilter dependencyFilter = inheritedFilter; if ( dependencyFilter != null && !dependencyFilter.include( dependencyArtifact ) ) { return null; } if ( Artifact.SCOPE_SYSTEM.equals( effectiveScope ) ) { dependencyArtifact.setFile( new File( dependency.getSystemPath() ) ); } dependencyArtifact.setDependencyFilter( createDependencyFilter( dependency, dependencyFilter ) ); return dependencyArtifact; }
artifact.setFile( new File( d.getSystemPath() ) );
String sysPath = dependency.getSystemPath(); if ( StringUtils.isNotEmpty( sysPath ) )
public static Dependency cloneDependency( Dependency src ) { Dependency result = null; if ( src != null ) { result = new Dependency(); result.setArtifactId( src.getArtifactId() ); result.setClassifier( src.getClassifier() ); result.setExclusions( cloneList( src.getExclusions(), DEPENDENCY_EXCLUSION_CLONER ) ); result.setGroupId( src.getGroupId() ); result.setOptional( src.isOptional() ); result.setScope( src.getScope() ); result.setSystemPath( src.getSystemPath() ); result.setType( src.getType() ); result.setVersion( src.getVersion() ); } return result; }
private void mergeDependencyWithDefaults( Dependency dep, Dependency def ) { if ( dep.getScope() == null && def.getScope() != null ) { dep.setScope( def.getScope() ); dep.setSystemPath( def.getSystemPath() ); } if ( dep.getVersion() == null && def.getVersion() != null ) { dep.setVersion( def.getVersion() ); } if ( dep.getClassifier() == null && def.getClassifier() != null ) { dep.setClassifier( def.getClassifier() ); } if ( dep.getType() == null && def.getType() != null ) { dep.setType( def.getType() ); } List exclusions = dep.getExclusions(); if ( exclusions == null || exclusions.isEmpty() ) { dep.setExclusions( def.getExclusions() ); } }
String systemPath = d.getSystemPath(); else if ( StringUtils.isNotEmpty( d.getSystemPath() ) ) String systemPath = d.getSystemPath(); else if ( StringUtils.isNotEmpty( d.getSystemPath() ) )
String systemPath = d.getSystemPath(); else if ( StringUtils.isNotEmpty( d.getSystemPath() ) )
for (org.apache.maven.model.Dependency d : project.getDependencies()) { final Artifact a = dependencyNode.getArtifact(); if (d.getSystemPath() != null && artifactsMatch(d, a)) { artifactFile = new File(d.getSystemPath()); isResolved = artifactFile.isFile(); groupId = a.getGroupId();
if ( dependency.getSystemPath() != null ) serializer.startTag( NAMESPACE, "systemPath" ).text( dependency.getSystemPath() ).endTag( NAMESPACE, "systemPath" );
out.write(indent + " type -> \"" + dependency.getType() + "\""); if (dependency.getSystemPath() != null) { out.write("," + br); out.write(indent + " systemPath -> \"" + dependency.getSystemPath() + "\"");
if ( dependency.getSystemPath() != null ) serializer.attribute( NAMESPACE, "systemPath", dependency.getSystemPath() );
public String getSystemPath() { return dependency.getSystemPath(); }
private String createSimpleSystemPath(Dependency artifactDependency, String dependencyType) { String artifactName = artifactDependency.getArtifactId().concat( "-" + artifactDependency.getVersion() + "." + dependencyType); String pomFileSystemPath = artifactDependency.getSystemPath(); return pomFileSystemPath.substring(0, pomFileSystemPath.lastIndexOf(CAppMavenUtils.POM_FILE_NAME)).concat( CAppMavenUtils.TARGET_DIR_NAME + File.separator + artifactName); }
protected void mergeDependency_SystemPath( Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getSystemPath(); if ( src != null ) { if ( sourceDominant || target.getSystemPath() == null ) { target.setSystemPath( src ); target.setLocation( "systemPath", source.getLocation( "systemPath" ) ); } } }
private static void interpolate(Map<String, String> dict, Iterable<Dependency> dependencies) { if (dependencies == null) { return; } for (Dependency d: dependencies) { d.setGroupId(interpolate(dict, d.getGroupId())); d.setArtifactId(interpolate(dict, d.getArtifactId())); d.setVersion(interpolate(dict, d.getVersion())); d.setClassifier(interpolate(dict, d.getClassifier())); d.setSystemPath(interpolate(dict, d.getSystemPath())); for (Exclusion e: d.getExclusions()) { e.setGroupId(interpolate(dict, e.getGroupId())); e.setArtifactId(interpolate(dict, e.getArtifactId())); } } }