PR: MNG-579

correct inclusion of tlds

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@224365 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-07-22 16:51:09 +00:00
parent f313b209dd
commit fd615cbeea
2 changed files with 24 additions and 17 deletions

View File

@ -33,6 +33,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
/**
* Build a war/webapp.
@ -155,25 +156,33 @@ public class WarMojo
FileUtils.copyDirectoryStructure( classesDirectory, webappClassesDirectory );
}
List runtimeArtifacts = project.getRuntimeArtifacts();
Set artifacts = project.getArtifacts();
for ( Iterator iter = runtimeArtifacts.iterator(); iter.hasNext(); )
for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
{
Artifact artifact = (Artifact) iter.next();
// TODO: utilise appropriate methods from project builder
// TODO: scope handler
// Include runtime and compile time libraries
// [jc, 21-June]: handle TLDs as a special-case.
if ( "tld".equals( artifact.getType() ) )
if ( !Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) &&
!!Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
{
FileUtils.copyFileToDirectory( artifact.getFile(), tldDirectory );
}
// [jc, 21-June]: I'm removing ( "jar".equals( artifact.getType() ) ) from consideration here
// we'll handle anything that's in the runtime classpath and NOT a SCOPE_PROVIDED artifact.
else if ( !Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) )
{
FileUtils.copyFileToDirectory( artifact.getFile(), libDirectory );
String type = artifact.getType();
if ( "tld".equals( type ) )
{
FileUtils.copyFileToDirectory( artifact.getFile(), tldDirectory );
}
else if ( "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type ) )
{
FileUtils.copyFileToDirectory( artifact.getFile(), libDirectory );
}
else
{
getLog().debug( "Skipping artifact of type " + type + " for WEB-INF/lib" );
}
}
}
}

View File

@ -331,6 +331,7 @@ public class MavenProject
{
Artifact a = (Artifact) i.next();
// TODO: classpath check doesn't belong here - that's the other method
if ( isAddedToClasspath( a ) )
{
// TODO: let the scope handler deal with this
@ -412,6 +413,7 @@ public class MavenProject
{
Artifact a = (Artifact) i.next();
// TODO: classpath check doesn't belong here - that's the other method
if ( isAddedToClasspath( a ) )
{
// TODO: let the scope handler deal with this
@ -494,6 +496,7 @@ public class MavenProject
{
Artifact a = (Artifact) i.next();
// TODO: classpath check doesn't belong here - that's the other method
if ( isAddedToClasspath( a ) )
{
// TODO: let the scope handler deal with this
@ -543,12 +546,7 @@ public class MavenProject
String type = artifact.getType();
// TODO: utilise type handler
if ( "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type ) )
{
return true;
}
return false;
return "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type );
}
// ----------------------------------------------------------------------