You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ji...@codehaus.org on 2003/09/25 09:00:10 UTC

[jira] Closed: (MAVEN-197) Artifact type handling - there is no way no add artifact of other type than jar to build classpath

Message:

   The following issue has been closed.

   Resolver: dion gillard
       Date: Thu, 25 Sep 2003 1:59 AM

Implemented ages ago. Method is in o.a.m.project.Dependency.
---------------------------------------------------------------------
View the issue:

  http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-197


Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MAVEN-197
    Summary: Artifact type handling - there is no way no add artifact of other type than jar to build classpath
       Type: Bug

     Status: Closed
   Priority: Major
 Resolution: FIXED

 Time Spent: Unknown
  Remaining: Unknown

    Project: maven
   Fix Fors:
             1.0-rc1
   Versions:
             1.0-beta-8

   Assignee: 
   Reporter: Michal Maczka

    Created: Sun, 12 Jan 2003 12:06 PM
    Updated: Thu, 25 Sep 2003 1:59 AM

Description:
Currently Maven adds to build class path only dependencies which
type is "jar".

There are dependencies of other type than jar (e.g. ejb modules)
which also contain java class files. 


Solution:



A Simple solution yet compatible with current code and additionally supporting adding to build class path dependencies of type "ejb" can look like follows:

1. add to artifact information if artifact should be added to build class path (e.g. new property addToClasspath). 
This information will be set by ArtifactFactory. More advanced implementation ArtifactFactory 
(e.g. configurable through config file) should be smart enough to set this property correctly basing on dependency type


public boolean addToClasspath() 
{
   return (getType().equals("jar") || getType().equals("ejb")); 
     
}



2. In class org.apache.maven.DependencyClasspathBuilder

This property of artifact can be than used in following way.


/**
     * Create the dependency classpath.
     *
     * @throws Exception If an error occurs while creating the classpath.
     */
    public static String build( Project project )
        throws Exception
    {
        //Path classpath = new Path( getProject().getRootContext().getAntProject() );
        StringBuffer classpath = new StringBuffer();

        for ( Iterator i = project.getArtifacts().iterator(); i.hasNext(); )
        {
            Artifact artifact = (Artifact) i.next();
            Dependency d = artifact.getDependency();

            if ()

            // Only add jar dependencies to the classpath
            if ( artifact.addToClasspath()==false)
            {
                continue;
            }

            classpath.append( artifact.getPath() ).append( cps );
            project.setDependencyPath( d.getId(), artifact.getPath() );
        }


This is still dirty, but marks the path for future refactoring and centralized the source
of problem (only addToClasspath property in Artifact will/should contain appropriate information)






---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org