private Dependency createSystemScopeDependency( Artifact artifact, File location, String suffix ) { String artifactId = artifact.getArtifactId(); if ( suffix != null ) { artifactId += "_" + suffix; } final Dependency dependency = new Dependency(); dependency.setGroupId( artifact.getGroupId() ); dependency.setArtifactId( artifactId ); dependency.setVersion( artifact.getBaseVersion() ); dependency.setScope( Artifact.SCOPE_SYSTEM ); dependency.setSystemPath( location.getAbsolutePath() ); return dependency; }
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 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() ); } }
dependency.setSystemPath( interpolatedTrimmed( parser.nextText(), "systemPath" ) );
dependency.setSystemPath( interpolatedTrimmed( parser.nextText(), "systemPath" ) );
dependency.setSystemPath( getTrimmedValue( value ) );
public void setSystemPath(String systemPath) { dependency.setSystemPath(systemPath); }
dependency.setSystemPath(systemPath);
private void updateProjectDependencies() { List<Dependency> dependencies = new ArrayList<Dependency>(); for (Capability capability : customCapabilities) { if ("shared".equals(capability.type)) { Dependency d = new Dependency(); d.setGroupId("OSGi"); d.setArtifactId(capability.id); d.setVersion(capability.versionRange); d.setType(BW6CommonMojo.BW6_SHARED_MODULE_PACKAGING); File f = capability.getFile(); if (f != null) { d.setScope("system"); d.setSystemPath(f.getAbsolutePath()); } dependencies.add(d); } } projectDependencies.put(mavenProject.getGroupId()+":"+mavenProject.getArtifactId()+":"+mavenProject.getVersion()+":"+mavenProject.getPackaging(), dependencies); }
protected Dependency newExternalDependency( String location, String p2Classifier, String artifactId, String version ) { File file = new File( location ); if ( !file.exists() || !file.isFile() || !file.canRead() ) { getLogger().warn( "Dependency at location " + location + " can not be represented in Maven model and will not be visible to non-OSGi aware Maven plugins" ); return null; } Dependency dependency = new Dependency(); dependency.setArtifactId( artifactId ); dependency.setGroupId( "p2." + p2Classifier ); // See also RepositoryLayoutHelper#getP2Gav dependency.setVersion( version ); dependency.setScope( Artifact.SCOPE_SYSTEM ); dependency.setSystemPath( location ); return dependency; }
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" ) ); } } }
/** * Build a dependency with scope system for the extracted war class files. * * @param artifact The original war artifact. * @param warClassesDirectory The directory in which the class files have been extracted. * @return A new dependency, set to scope system, to include in the project's compile classpath. */ private Dependency getWarClassesDependency(Artifact artifact, File warClassesDirectory) throws OverConstrainedVersionException { Dependency dependency = new Dependency(); dependency.setArtifactId(artifact.getArtifactId()); dependency.setGroupId(artifact.getGroupId()); dependency.setType("classes"); dependency.setScope(Artifact.SCOPE_SYSTEM); dependency.setOptional(true); dependency.setVersion(artifact.getSelectedVersion().toString()); dependency.setSystemPath(warClassesDirectory.getPath()); return dependency; }
private Dependency createSystemScopeDependency(ArtifactKey artifactKey, String groupId, File location) { Dependency dependency = new Dependency(); dependency.setGroupId(groupId); dependency.setArtifactId(artifactKey.getId()); dependency.setVersion(artifactKey.getVersion()); dependency.setScope(Artifact.SCOPE_SYSTEM); dependency.setSystemPath(location.getAbsolutePath()); return dependency; }
public static Dependency createDependency(String groupId, String artifactId, String version, String scope, String type, String systemPath) { Dependency dependency = new Dependency(); dependency.setGroupId(groupId); dependency.setArtifactId(artifactId); if (version!=null) { dependency.setVersion(version); } if (scope!=null) { dependency.setScope(scope); } if (systemPath!=null) { dependency.setSystemPath(systemPath); } if (type!=null) { dependency.setType(type); } return dependency; }
public static 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()); } } }
public static 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()); } @SuppressWarnings("rawtypes") List exclusions = dep.getExclusions(); if (exclusions == null || exclusions.isEmpty()) { dep.setExclusions(def.getExclusions()); } } }
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())); } } }
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())); } } }
/** * Creates a dependency using information from the specified project dependency. * * @param projectDependency a project dependency to use as the source of the returned dependency * @return a dependency created using information from the specified project dependency */ public static Dependency createDependencyFrom( ProjectDependency projectDependency ) { logAndVerifyProjectParameters( projectDependency ); Dependency dependency = new Dependency(); dependency.setGroupId( projectDependency.getGroupId() ); dependency.setArtifactId( projectDependency.getArtifactId() ); dependency.setVersion( projectDependency.getVersion() ); dependency.setType( projectDependency.getArtifactType() ); dependency.setClassifier( projectDependency.getPublicKeyTokenId() ); dependency.setScope(projectDependency.getScope()); dependency.setSystemPath(projectDependency.getSystemPath()); return dependency; }