You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jd...@apache.org on 2005/05/06 02:38:10 UTC
svn commit: r168485 -
/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
Author: jdcasey
Date: Thu May 5 17:38:10 2005
New Revision: 168485
URL: http://svn.apache.org/viewcvs?rev=168485&view=rev
Log:
Missed one on the mojo api cleanup and dupe checking commit...
Modified:
maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java?rev=168485&r1=168484&r2=168485&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java Thu May 5 17:38:10 2005
@@ -23,6 +23,7 @@
import org.apache.maven.model.Build;
import org.apache.maven.model.CiManagement;
import org.apache.maven.model.Contributor;
+import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.Developer;
import org.apache.maven.model.DistributionManagement;
@@ -253,6 +254,38 @@
return list;
}
+ public List getCompileDependencies()
+ {
+ Set artifacts = getArtifacts();
+
+ if(artifacts == null || artifacts.isEmpty())
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ List list = new ArrayList( artifacts.size() );
+
+ for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
+ {
+ Artifact a = (Artifact) i.next();
+
+ // TODO: let the scope handler deal with this
+ if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) )
+ {
+ Dependency dependency = new Dependency();
+
+ dependency.setArtifactId( a.getArtifactId() );
+ dependency.setGroupId( a.getGroupId() );
+ dependency.setVersion( a.getVersion() );
+ dependency.setScope( a.getScope() );
+ dependency.setType( a.getType() );
+
+ list.add( dependency );
+ }
+ }
+ return list;
+ }
+
public List getTestClasspathElements()
throws DependencyResolutionRequiredException
{
@@ -267,8 +300,8 @@
if ( isAddedToClasspath( a ) )
{
// TODO: let the scope handler deal with this
- if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() ) ||
- Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
+ if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() )
+ || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
{
File file = a.getFile();
if ( file == null )
@@ -282,6 +315,39 @@
return list;
}
+ public List getTestDependencies()
+ {
+ Set artifacts = getArtifacts();
+
+ if(artifacts == null || artifacts.isEmpty())
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ List list = new ArrayList( artifacts.size() );
+
+ for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
+ {
+ Artifact a = (Artifact) i.next();
+
+ // TODO: let the scope handler deal with this
+ if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() )
+ || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
+ {
+ Dependency dependency = new Dependency();
+
+ dependency.setArtifactId( a.getArtifactId() );
+ dependency.setGroupId( a.getGroupId() );
+ dependency.setVersion( a.getVersion() );
+ dependency.setScope( a.getScope() );
+ dependency.setType( a.getType() );
+
+ list.add( dependency );
+ }
+ }
+ return list;
+ }
+
public List getRuntimeClasspathElements()
throws DependencyResolutionRequiredException
{
@@ -310,6 +376,38 @@
return list;
}
+ public List getRuntimeDependencies()
+ {
+ Set artifacts = getArtifacts();
+
+ if(artifacts == null || artifacts.isEmpty())
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ List list = new ArrayList( artifacts.size() );
+
+ for ( Iterator i = artifacts.iterator(); i.hasNext(); )
+ {
+ Artifact a = (Artifact) i.next();
+
+ // TODO: let the scope handler deal with this
+ if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
+ {
+ Dependency dependency = new Dependency();
+
+ dependency.setArtifactId( a.getArtifactId() );
+ dependency.setGroupId( a.getGroupId() );
+ dependency.setVersion( a.getVersion() );
+ dependency.setScope( a.getScope() );
+ dependency.setType( a.getType() );
+
+ list.add( dependency );
+ }
+ }
+ return list;
+ }
+
private static boolean isAddedToClasspath( Artifact artifact )
{
String type = artifact.getType();
@@ -649,14 +747,13 @@
{
Artifact existing = (Artifact) artifacts.get( id );
boolean updateScope = false;
- if ( Artifact.SCOPE_RUNTIME.equals( a.getScope() ) &&
- Artifact.SCOPE_TEST.equals( existing.getScope() ) )
+ if ( Artifact.SCOPE_RUNTIME.equals( a.getScope() ) && Artifact.SCOPE_TEST.equals( existing.getScope() ) )
{
updateScope = true;
}
- if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) &&
- !Artifact.SCOPE_COMPILE.equals( existing.getScope() ) )
+ if ( Artifact.SCOPE_COMPILE.equals( a.getScope() )
+ && !Artifact.SCOPE_COMPILE.equals( existing.getScope() ) )
{
updateScope = true;
}
@@ -667,8 +764,8 @@
// TODO: [jc] Is this a better way to centralize artifact construction here?
Artifact artifact = artifactFactory.createArtifact( existing.getGroupId(),
existing.getArtifactId(),
- existing.getVersion(), a.getScope(),
- existing.getType() );
+ existing.getVersion(), a.getScope(), existing
+ .getType() );
artifact.setFile( existing.getFile() );
artifact.setBaseVersion( existing.getBaseVersion() );
@@ -749,4 +846,3 @@
return model.getPluginRepositories();
}
}
-
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org