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,28 +76,27 @@ public class MavenArchiver
if ( addClasspath )
{
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();
/* TODO: need to add to jar plugin config
Properties properties = dependency.getProperties();
if ( Boolean.valueOf(properties.getProperty("manifest.classpath")).booleanValue())
Artifact artifact = (Artifact) iter.next();
if ( "jar".equals( artifact.getType() ) && Artifact.SCOPE_RUNTIME.equals( artifact.getScope() ) )
{
if (classpath.length() > 0 )
if ( classpath.length() > 0 )
{
classpath.append( " " );
}
// TODO replace dependency by artifact
classpath.append( dependency.getArtifactId() + "-" + dependency.getVersion() + ".jar");
classpath.append( artifact.getArtifactId() + "-" + artifact.getVersion() + ".jar");
}
*/
}
Manifest.Attribute classpathAttr = new Manifest.Attribute( "Class-Path", classpath.toString() );
m.addConfiguredAttribute( classpathAttr );
if ( classpath.length() > 0 )
{
Manifest.Attribute classpathAttr = new Manifest.Attribute( "Class-Path", classpath.toString() );
m.addConfiguredAttribute( classpathAttr );
}
}
// Added supplementary entries