Add all dependencies with runtime scope in Class-Path manifest attribute if addClasspath is true in plugin configuration

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163517 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-03-10 09:44:49 +00:00
parent abbecd7c82
commit c32adefa9f
1 changed files with 11 additions and 12 deletions

View File

@ -76,29 +76,28 @@ public class MavenArchiver
if ( addClasspath ) if ( addClasspath )
{ {
StringBuffer classpath = new StringBuffer(); StringBuffer classpath = new StringBuffer();
List dependencies = project.getDependencies(); Set artifacts = project.getArtifacts();
for ( Iterator iter = dependencies.iterator(); iter.hasNext(); ) for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
{ {
Dependency dependency = (Dependency) iter.next(); Artifact artifact = (Artifact) iter.next();
/* TODO: need to add to jar plugin config if ( "jar".equals( artifact.getType() ) && Artifact.SCOPE_RUNTIME.equals( artifact.getScope() ) )
Properties properties = dependency.getProperties();
if ( Boolean.valueOf(properties.getProperty("manifest.classpath")).booleanValue())
{ {
if (classpath.length() > 0 ) if ( classpath.length() > 0 )
{ {
classpath.append( " " ); classpath.append( " " );
} }
// TODO replace dependency by artifact classpath.append( artifact.getArtifactId() + "-" + artifact.getVersion() + ".jar");
classpath.append( dependency.getArtifactId() + "-" + dependency.getVersion() + ".jar");
} }
*/
} }
if ( classpath.length() > 0 )
{
Manifest.Attribute classpathAttr = new Manifest.Attribute( "Class-Path", classpath.toString() ); Manifest.Attribute classpathAttr = new Manifest.Attribute( "Class-Path", classpath.toString() );
m.addConfiguredAttribute( classpathAttr ); m.addConfiguredAttribute( classpathAttr );
} }
}
// Added supplementary entries // Added supplementary entries
Manifest.Attribute extensionNameAttr = new Manifest.Attribute( "Extension-Name", project.getArtifactId() ); Manifest.Attribute extensionNameAttr = new Manifest.Attribute( "Extension-Name", project.getArtifactId() );