mirror of https://github.com/apache/maven.git
Add dependencies in war and add support of scope deps
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163502 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7f6f4452f2
commit
a90ea9bc76
|
@ -4,4 +4,17 @@
|
|||
<artifactId>maven-core-it0016</artifactId>
|
||||
<type>war</type>
|
||||
<version>1.0</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>servletapi</groupId>
|
||||
<artifactId>servletapi</artifactId>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Set;
|
|||
|
||||
import org.apache.maven.archiver.MavenArchiver;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.plugin.AbstractPlugin;
|
||||
import org.apache.maven.plugin.PluginExecutionRequest;
|
||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
||||
|
@ -144,12 +143,6 @@ import org.codehaus.plexus.util.FileUtils;
|
|||
* validator=""
|
||||
* expression="#project.build.directory"
|
||||
* description=""
|
||||
* @parameter name="localRepository"
|
||||
* type="org.apache.maven.artifact.repository.ArtifactRepository"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#localRepository"
|
||||
* description=""
|
||||
* @parameter
|
||||
* name="project"
|
||||
* type="org.apache.maven.project.MavenProject"
|
||||
|
@ -172,8 +165,6 @@ public class WarMojo
|
|||
|
||||
private MavenProject project;
|
||||
|
||||
private ArtifactRepository localRepository;
|
||||
|
||||
private File classesDirectory;
|
||||
|
||||
private String outputDirectory;
|
||||
|
@ -211,13 +202,12 @@ public class WarMojo
|
|||
}
|
||||
|
||||
/**
|
||||
* @todo properties 'war.bundle' and 'war.target.path'
|
||||
* @todo copy classes to classes webapp directory
|
||||
* @todo properties 'war.target.path'
|
||||
*/
|
||||
public void buildWebapp( MavenProject project )
|
||||
throws IOException
|
||||
{
|
||||
request.getLog().info( "Assembling webapp " + project.getArtifactId() );
|
||||
request.getLog().info( "Assembling webapp " + project.getArtifactId() + " in " + webappDirectory.getAbsolutePath() );
|
||||
|
||||
File libDirectory = new File( webappDirectory, WEB_INF + "/lib" );
|
||||
|
||||
|
@ -235,13 +225,14 @@ public class WarMojo
|
|||
for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
|
||||
{
|
||||
Artifact artifact = (Artifact) iter.next();
|
||||
if ( "jar".equals( artifact.getType() ) )
|
||||
|
||||
if ( "jar".equals( artifact.getType() ) && Artifact.SCOPE_RUNTIME.equals( artifact.getScope() ) )
|
||||
{
|
||||
FileUtils.copyFileToDirectory( new File( localRepository.getBasedir(), artifact.toString() ) , libDirectory );
|
||||
FileUtils.copyFileToDirectory( artifact.getFile() , libDirectory );
|
||||
}
|
||||
if ( "tld".equals( artifact.getType() ) )
|
||||
{
|
||||
FileUtils.copyFileToDirectory( new File( localRepository.getBasedir(), artifact.toString() ) , tldDirectory );
|
||||
FileUtils.copyFileToDirectory( artifact.getFile() , tldDirectory );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -318,8 +309,6 @@ public class WarMojo
|
|||
|
||||
project = (MavenProject) request.getParameter( "project" );
|
||||
|
||||
localRepository = (ArtifactRepository) request.getParameter( "localRepository" );
|
||||
|
||||
classesDirectory = new File( (String) request.getParameter( "classesDirectory" ) );
|
||||
|
||||
outputDirectory = (String) request.getParameter( "outputDirectory" );
|
||||
|
|
Loading…
Reference in New Issue