You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2003/05/20 05:55:51 UTC

cvs commit: maven-new/core/src/java/org/apache/maven/project Project.java

jvanzyl     2003/05/19 20:55:51

  Modified:    core/src/java/org/apache/maven/project Project.java
  Log:
  o Lazily instantiate the collections used within the project. This makes the aspect used for
    inheritance cleaner as we don't have to look for empty collections we can just
    look for a null value.
  
  Revision  Changes    Path
  1.3       +184 -196  maven-new/core/src/java/org/apache/maven/project/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/maven-new/core/src/java/org/apache/maven/project/Project.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Project.java	27 Apr 2003 13:49:02 -0000	1.2
  +++ Project.java	20 May 2003 03:55:51 -0000	1.3
  @@ -56,6 +56,10 @@
    * ====================================================================
    */
   
  +import org.apache.maven.Maven;
  +import org.apache.maven.MavenConstants;
  +import org.apache.plexus.util.StringUtils;
  +
   import java.io.File;
   import java.util.ArrayList;
   import java.util.HashMap;
  @@ -66,12 +70,6 @@
   import java.util.StringTokenizer;
   import java.util.TreeSet;
   
  -import org.apache.maven.DeprecationWarning;
  -import org.apache.maven.Maven;
  -import org.apache.maven.MavenConstants;
  -import org.apache.maven.project.builder.ArtifactListBuilder;
  -import org.apache.plexus.util.StringUtils;
  -
   /**
    * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
  @@ -86,6 +84,7 @@
   {
       /** Project dependencies */
       private List dependencies;
  +
       public static final String CONTEXT_KEY = Project.class.getName();
   
       /** Repository where this project is stored. */
  @@ -212,17 +211,9 @@
        */
       public Project()
       {
  -        dependencies = new ArrayList();
  -        mailingLists = new ArrayList();
  -        developers = new ArrayList();
  -        contributors = new ArrayList();
  -        licenses = new ArrayList();
  -        versions = new ArrayList();
           dependencyPaths = new HashMap();
           dependencyMap = new HashMap();
           goalNames = new ArrayList();
  -        reports = new ArrayList();
  -        packageGroups = new ArrayList();
       }
   
       // ----------------------------------------------------------------------
  @@ -233,7 +224,7 @@
   
       public String getId()
       {
  -        return id;
  +        return getGroupId() + ":" + getArtifactId();
       }
   
       /**
  @@ -242,7 +233,7 @@
        *
        * @param artifactId The artifactId.
        */
  -    public void setArtifactId(String artifactId)
  +    public void setArtifactId( String artifactId )
       {
           this.artifactId = artifactId;
       }
  @@ -262,7 +253,7 @@
        *
        * @param groupId Project group id.
        */
  -    public void setGroupId(String groupId)
  +    public void setGroupId( String groupId )
       {
           this.groupId = groupId;
       }
  @@ -292,7 +283,7 @@
        *
        * @param artifactList
        */
  -    public void setArtifacts(List artifactList)
  +    public void setArtifacts( List artifactList )
       {
           this.artifactList = artifactList;
       }
  @@ -312,7 +303,7 @@
        *
        * @param file POM file
        */
  -    public void setFile(File file)
  +    public void setFile( File file )
       {
           this.file = file;
       }
  @@ -344,7 +335,7 @@
        *
        * @param parent
        */
  -    public void setParent(Project parent)
  +    public void setParent( Project parent )
       {
           this.parent = parent;
       }
  @@ -354,7 +345,7 @@
        *
        * @param pomToExtend Project which this project extends.
        */
  -    public void setExtend(String pomToExtend)
  +    public void setExtend( String pomToExtend )
       {
           this.pomToExtend = pomToExtend;
       }
  @@ -396,7 +387,7 @@
        */
       public File parentMavenXml()
       {
  -        return new File(getParent().getFile().getParentFile(), "maven.xml");
  +        return new File( getParent().getFile().getParentFile(), "maven.xml" );
       }
   
       // ----------------------------------------------------------------------
  @@ -408,7 +399,7 @@
        *
        * @param gumpRepositoryId Gump repository id.
        */
  -    public void setGumpRepositoryId(String gumpRepositoryId)
  +    public void setGumpRepositoryId( String gumpRepositoryId )
       {
           this.gumpRepositoryId = gumpRepositoryId;
       }
  @@ -428,7 +419,7 @@
        *
        * @param shortDescription Short description of project.
        */
  -    public void setShortDescription(String shortDescription)
  +    public void setShortDescription( String shortDescription )
       {
           this.shortDescription = shortDescription;
       }
  @@ -445,7 +436,7 @@
   
       public String getArtifactDirectory()
       {
  -        if (isValid(getGroupId()))
  +        if ( isValid( getGroupId() ) )
           {
               return getGroupId();
           }
  @@ -453,7 +444,7 @@
           // Now we want the artifact directory to be the legacy form
           // of the id which contains no ":" character so lets flip
           // it back to legacy form.
  -        return standardToLegacyId(getId());
  +        return standardToLegacyId( getId() );
       }
   
       /**
  @@ -462,7 +453,7 @@
        * @param siteAddress the hostname of the web server that hosts the
        *        project's web site (ex: "jakarta.apache.org")
        */
  -    public void setSiteAddress(String siteAddress)
  +    public void setSiteAddress( String siteAddress )
       {
           this.siteAddress = siteAddress;
       }
  @@ -485,7 +476,7 @@
        *        web site for this project resides
        *        (ex: "/www/jakarta.apache.org/turbine/maven/")
        */
  -    public void setSiteDirectory(String siteDirectory)
  +    public void setSiteDirectory( String siteDirectory )
       {
           this.siteDirectory = siteDirectory;
       }
  @@ -506,7 +497,7 @@
        * @param distributionSite the server where the
        *        final distributions will be published
        */
  -    public void setDistributionSite(String distributionSite)
  +    public void setDistributionSite( String distributionSite )
       {
           this.distributionSite = distributionSite;
       }
  @@ -528,7 +519,7 @@
        *        final distributions will be published
        *        (ex: "/www/jakarta.apache.org/builds/jakarta-turbine-maven/")
        */
  -    public void setDistributionDirectory(String distributionDirectory)
  +    public void setDistributionDirectory( String distributionDirectory )
       {
           this.distributionDirectory = distributionDirectory;
       }
  @@ -548,12 +539,17 @@
        *
        * @param dependency Dependency for this project.
        */
  -    public void addDependency(Dependency dependency)
  +    public void addDependency( Dependency dependency )
       {
  -        if (!dependencies.contains(dependency))
  +        if ( dependencies == null )
  +        {
  +            dependencies = new ArrayList();
  +        }
  +
  +        if ( !dependencies.contains( dependency ) )
           {
  -            dependencies.add(dependency);
  -            dependencyMap.put(dependency.getId(), dependency);
  +            dependencies.add( dependency );
  +            dependencyMap.put( dependency.getId(), dependency );
           }
       }
   
  @@ -562,7 +558,7 @@
        *
        * @param dependencies List of dependencies to add to the project.
        */
  -    public void setDependencies(List dependencies)
  +    public void setDependencies( List dependencies )
       {
           this.dependencies = dependencies;
       }
  @@ -577,11 +573,11 @@
           return dependencies;
       }
   
  -    public void addParentDependencies(List dependencies)
  +    public void addParentDependencies( List dependencies )
       {
  -        for (Iterator i = dependencies.iterator(); i.hasNext();)
  +        for ( Iterator i = dependencies.iterator(); i.hasNext(); )
           {
  -            addDependency((Dependency) i.next());
  +            addDependency( (Dependency) i.next() );
           }
       }
   
  @@ -595,10 +591,10 @@
           Set projectIds = new TreeSet();
           List dependencies = getDependencies();
           Dependency dependency = null;
  -        for (int i = 0; i < dependencies.size(); i++)
  +        for ( int i = 0; i < dependencies.size(); i++ )
           {
  -            dependency = (Dependency) dependencies.get(i);
  -            projectIds.add(dependency.getId());
  +            dependency = (Dependency) dependencies.get( i );
  +            projectIds.add( dependency.getId() );
           }
           return projectIds;
       }
  @@ -609,9 +605,9 @@
        * @param id Dependency id.
        * @param path Classpath for the given dependency.
        */
  -    public void setDependencyPath(String id, String path)
  +    public void setDependencyPath( String id, String path )
       {
  -        dependencyPaths.put(id, path);
  +        dependencyPaths.put( id, path );
       }
   
       /**
  @@ -620,9 +616,9 @@
        * @param id Dependency id.
        * @return Classpath for the given dependency.
        */
  -    public String getDependencyPath(String id)
  +    public String getDependencyPath( String id )
       {
  -        return (String) dependencyPaths.get(legacyToStandardId(id));
  +        return (String) dependencyPaths.get( legacyToStandardId( id ) );
       }
   
       /**
  @@ -631,9 +627,9 @@
        * @param id Dependency id.
        * @return Dependency for the given id.
        */
  -    public Dependency getDependency(String id)
  +    public Dependency getDependency( String id )
       {
  -        return (Dependency) dependencyMap.get(legacyToStandardId(id));
  +        return (Dependency) dependencyMap.get( legacyToStandardId( id ) );
       }
   
       /**
  @@ -641,11 +637,16 @@
        *
        * @param report report for this project.
        */
  -    public void addReport(String report)
  +    public void addReport( String report )
       {
  -        if (reports.contains(report) == false)
  +        if ( reports == null )
           {
  -            reports.add(report);
  +            reports = new ArrayList();
  +        }
  +
  +        if ( reports.contains( report ) == false )
  +        {
  +            reports.add( report );
           }
       }
   
  @@ -654,7 +655,7 @@
        *
        * @param reports
        */
  -    public void setReports(List reports)
  +    public void setReports( List reports )
       {
           this.reports = reports;
       }
  @@ -674,7 +675,7 @@
        *
        * @param build the build environment of a project
        */
  -    public void setBuild(Build build)
  +    public void setBuild( Build build )
       {
           this.build = build;
       }
  @@ -694,9 +695,14 @@
        *
        * @param mailingList Mailing list for this project.
        */
  -    public void addMailingList(MailingList mailingList)
  +    public void addMailingList( MailingList mailingList )
       {
  -        mailingLists.add(mailingList);
  +        if ( mailingLists == null )
  +        {
  +            mailingLists = new ArrayList();
  +        }
  +
  +        mailingLists.add( mailingList );
       }
   
       /**
  @@ -704,7 +710,7 @@
        *
        * @param mailingLists Set the mailing lists for the project.
        */
  -    public void setMailingLists(List mailingLists)
  +    public void setMailingLists( List mailingLists )
       {
           this.mailingLists = mailingLists;
       }
  @@ -724,9 +730,13 @@
        *
        * @param developer Developer for this project.
        */
  -    public void addDeveloper(Developer developer)
  +    public void addDeveloper( Developer developer )
       {
  -        developers.add(developer);
  +        if ( developers == null )
  +        {
  +            developers = new ArrayList();
  +        }
  +        developers.add( developer );
       }
   
       /**
  @@ -734,7 +744,7 @@
        *
        * @param developers Project developers.
        */
  -    public void setDevelopers(List developers)
  +    public void setDevelopers( List developers )
       {
           this.developers = developers;
       }
  @@ -754,7 +764,7 @@
        *
        * @param contributors Contributors for this project.
        */
  -    public void setContributors(List contributors)
  +    public void setContributors( List contributors )
       {
           this.contributors = contributors;
       }
  @@ -764,9 +774,14 @@
        *
        * @param contributor Contributor for this project.
        */
  -    public void addContributor(Contributor contributor)
  +    public void addContributor( Contributor contributor )
       {
  -        contributors.add(contributor);
  +        if ( contributors == null )
  +        {
  +            contributors = new ArrayList();
  +        }
  +
  +        contributors.add( contributor );
       }
   
       /**
  @@ -784,7 +799,7 @@
        *
        * @param licenses Licenses for this project.
        */
  -    public void setLicenses(List licenses)
  +    public void setLicenses( List licenses )
       {
           this.licenses = licenses;
       }
  @@ -794,9 +809,14 @@
        *
        * @param license License for this project.
        */
  -    public void addLicense(License license)
  +    public void addLicense( License license )
       {
  -        licenses.add(license);
  +        if ( licenses == null )
  +        {
  +            licenses = new ArrayList();
  +        }
  +
  +        licenses.add( license );
       }
   
       /**
  @@ -814,7 +834,7 @@
        *
        * @param repository the repository this project is part of
        */
  -    public void setRepository(Repository repository)
  +    public void setRepository( Repository repository )
       {
           this.repository = repository;
       }
  @@ -834,7 +854,7 @@
        *
        * @param url the URL to the organization's home page
        */
  -    public void setUrl(String url)
  +    public void setUrl( String url )
       {
           this.url = url;
       }
  @@ -854,7 +874,7 @@
        *
        * @param issueTrackingUrl the URL to the project's issue tracking system
        */
  -    public void setIssueTrackingUrl(String issueTrackingUrl)
  +    public void setIssueTrackingUrl( String issueTrackingUrl )
       {
           this.issueTrackingUrl = issueTrackingUrl;
       }
  @@ -874,7 +894,7 @@
        *
        * @param description the long description of the project
        */
  -    public void setDescription(String description)
  +    public void setDescription( String description )
       {
           this.description = description;
       }
  @@ -897,7 +917,7 @@
        */
       public boolean hasRepository()
       {
  -        return (repository != null);
  +        return ( repository != null );
       }
   
       /**
  @@ -906,7 +926,7 @@
        * @param currentVersion the current version number of the project, e.g.
        * <code>1.0</code>, <code>1.1-dev</code>
        */
  -    public void setCurrentVersion(String currentVersion)
  +    public void setCurrentVersion( String currentVersion )
       {
           this.currentVersion = currentVersion;
       }
  @@ -927,7 +947,7 @@
        *
        * @param organization the organisation name
        */
  -    public void setOrganization(Organization organization)
  +    public void setOrganization( Organization organization )
       {
           this.organization = organization;
       }
  @@ -948,7 +968,7 @@
        * @param projectPackage the package name, e.g.
        * <code>org.apache.maven</code>
        */
  -    public void setPackage(String projectPackage)
  +    public void setPackage( String projectPackage )
       {
           this.projectPackage = projectPackage;
       }
  @@ -969,7 +989,7 @@
        *
        * @param inceptionYear the year the project started, e.g. <code>2000</code>
        */
  -    public void setInceptionYear(String inceptionYear)
  +    public void setInceptionYear( String inceptionYear )
       {
           this.inceptionYear = inceptionYear;
       }
  @@ -989,7 +1009,7 @@
        *
        * @param pomVersion the new value
        */
  -    public void setPomVersion(String pomVersion)
  +    public void setPomVersion( String pomVersion )
       {
           this.pomVersion = pomVersion;
       }
  @@ -1002,10 +1022,6 @@
        */
       public String getPomVersion()
       {
  -        if (pomVersion == null)
  -        {
  -            pomVersion = "1";
  -        }
           return pomVersion;
       }
   
  @@ -1018,7 +1034,7 @@
        */
       public boolean isPomCurrent()
       {
  -        return Integer.parseInt(getPomVersion()) == MavenConstants.POM_VERSION;
  +        return Integer.parseInt( getPomVersion() ) == MavenConstants.POM_VERSION;
       }
   
       /**
  @@ -1026,9 +1042,14 @@
        *
        * @param version Distribution for this project.
        */
  -    public void addVersion(Version version)
  +    public void addVersion( Version version )
       {
  -        versions.add(version);
  +        if ( versions == null )
  +        {
  +            versions = new ArrayList();
  +        }
  +
  +        versions.add( version );
       }
   
       /**
  @@ -1036,7 +1057,7 @@
        *
        * @param versions List of versions for this project.
        */
  -    public void setVersions(List versions)
  +    public void setVersions( List versions )
       {
           this.versions = versions;
       }
  @@ -1057,23 +1078,23 @@
        * @param versionId the id of the version to return
        * @return List of distributions.
        */
  -    public Version getVersionById(String versionId)
  +    public Version getVersionById( String versionId )
       {
           // We have to lazily initialize this because of betwixt/digester
           // behavior where an objects addXXX() method is called but
           // the parameter object is not yet fully populated.
  -        if (versionMap == null)
  +        if ( versionMap == null )
           {
               versionMap = new HashMap();
   
  -            for (Iterator i = versions.iterator(); i.hasNext();)
  +            for ( Iterator i = versions.iterator(); i.hasNext(); )
               {
                   Version version = (Version) i.next();
  -                versionMap.put(version.getId(), version);
  +                versionMap.put( version.getId(), version );
               }
           }
   
  -        return (Version) versionMap.get(versionId);
  +        return (Version) versionMap.get( versionId );
       }
   
       /**
  @@ -1081,7 +1102,7 @@
        *
        * @param logo the url for the project logo image.
        */
  -    public void setLogo(String logo)
  +    public void setLogo( String logo )
       {
           this.logo = logo;
       }
  @@ -1112,7 +1133,7 @@
        *
        * @param packageGroups is the list of PackageGroup instances
        */
  -    public void setPackageGroups(List packageGroups)
  +    public void setPackageGroups( List packageGroups )
       {
           this.packageGroups = packageGroups;
       }
  @@ -1123,9 +1144,14 @@
        * @param packageGroup is the new PackageGroup instance to be added to the
        * list
        */
  -    public void addPackageGroup(PackageGroup packageGroup)
  +    public void addPackageGroup( PackageGroup packageGroup )
       {
  -        packageGroups.add(packageGroup);
  +        if ( packageGroups == null )
  +        {
  +            packageGroups = new ArrayList();
  +        }
  +
  +        packageGroups.add( packageGroup );
       }
   
       // ----------------------------------------------------------------------
  @@ -1143,7 +1169,7 @@
        *
        * @param dependencyClasspath Dependency classpath.
        */
  -    public void setDependencyClasspath(String dependencyClasspath)
  +    public void setDependencyClasspath( String dependencyClasspath )
       {
           this.dependencyClasspath = dependencyClasspath;
       }
  @@ -1174,9 +1200,9 @@
        *
        * @param goals Goals to be satisfied.
        */
  -    public void setGoalNames(List goals)
  +    public void setGoalNames( List goals )
       {
  -        getGoalNames().addAll(goals);
  +        getGoalNames().addAll( goals );
       }
   
       /**
  @@ -1184,15 +1210,15 @@
        *
        * @param goalsCsv List of goals in CSV form.
        */
  -    public void setGoalNames(String goalsCsv)
  +    public void setGoalNames( String goalsCsv )
       {
  -        if (goalNames != null)
  +        if ( goalNames != null )
           {
  -            StringTokenizer tokens = new StringTokenizer(goalsCsv, ",");
  +            StringTokenizer tokens = new StringTokenizer( goalsCsv, "," );
   
  -            while (tokens.hasMoreTokens())
  +            while ( tokens.hasMoreTokens() )
               {
  -                goalNames.add(tokens.nextToken().trim());
  +                goalNames.add( tokens.nextToken().trim() );
               }
           }
       }
  @@ -1215,19 +1241,19 @@
        * @param id
        * @return
        */
  -    public static String legacyToStandardId(String id)
  +    public static String legacyToStandardId( String id )
       {
           String newId = id;
  -        if (id.indexOf("+") != -1)
  +        if ( id.indexOf( "+" ) != -1 )
           {
               // legacy format is groupId "+" partial artifactId
               // standard format is groupId ":" groupId "-" partialArtifactId
  -            int plusPos = id.indexOf("+");
  -            String groupId = id.substring(0, plusPos);
  -            String partialArtifactId = id.substring(plusPos + 1);
  +            int plusPos = id.indexOf( "+" );
  +            String groupId = id.substring( 0, plusPos );
  +            String partialArtifactId = id.substring( plusPos + 1 );
               newId = groupId + ":" + groupId + "-" + partialArtifactId;
           }
  -        else if (id.indexOf(":") == -1)
  +        else if ( id.indexOf( ":" ) == -1 )
           {
               newId += ":" + id;
           }
  @@ -1249,18 +1275,18 @@
        * @param id
        * @return
        */
  -    public static String standardToLegacyId(String id)
  +    public static String standardToLegacyId( String id )
       {
  -        if (id == null)
  +        if ( id == null )
           {
  -            throw new NullPointerException("Project.standardToLegacyId does not accept id == null");
  +            throw new NullPointerException( "Project.standardToLegacyId does not accept id == null" );
           }
   
  -        int i = id.indexOf(":");
  +        int i = id.indexOf( ":" );
   
  -        if (i > 0)
  +        if ( i > 0 )
           {
  -            id = id.substring(i + 1);
  +            id = id.substring( i + 1 );
           }
   
           return id;
  @@ -1280,21 +1306,21 @@
        *  @return The boolean value of the property if convertiable,
        *          otherwise <code>Boolean.FALSE</code>.
        */
  -    public Boolean getBoolean(String key)
  +    public Boolean getBoolean( String key )
       {
           // After changing the processing everything is now a Boolean already
           // but I want to keep the type check for the time being.
   
  -        Object value = getVariable(key);
  +        Object value = getVariable( key );
   
  -        if (value instanceof Boolean)
  +        if ( value instanceof Boolean )
           {
               return (Boolean) value;
           }
   
           String stringValue = (String) value;
   
  -        if ("true".equalsIgnoreCase(stringValue) || "on".equalsIgnoreCase(stringValue) || "1".equals(value))
  +        if ( "true".equalsIgnoreCase( stringValue ) || "on".equalsIgnoreCase( stringValue ) || "1".equals( value ) )
           {
               return Boolean.TRUE;
           }
  @@ -1311,9 +1337,9 @@
        *
        * @param mavenSession
        */
  -    public void setMaven(Maven mavenSession)
  +    public void setMaven( Maven mavenSession )
       {
  -        setVariable(MavenConstants.SESSION, mavenSession);
  +        setVariable( MavenConstants.SESSION, mavenSession );
       }
   
       /**
  @@ -1323,7 +1349,7 @@
        */
       public Maven getMaven()
       {
  -        return (Maven) getVariable(MavenConstants.SESSION);
  +        return (Maven) getVariable( MavenConstants.SESSION );
       }
   
       /**
  @@ -1331,9 +1357,9 @@
        *
        * @param mavenRemoteRepo Remote repository to add.
        */
  -    public void addMavenRemoteRepo(String mavenRemoteRepo)
  +    public void addMavenRemoteRepo( String mavenRemoteRepo )
       {
  -        ((List) getVariable(MavenConstants.REPO_REMOTE)).add(mavenRemoteRepo);
  +        ( (List) getVariable( MavenConstants.REPO_REMOTE ) ).add( mavenRemoteRepo );
       }
   
       /**
  @@ -1341,9 +1367,9 @@
        *
        * @param mavenRepoRemote List of remove repositories.
        */
  -    public void setMavenRepoRemotes(List mavenRepoRemote)
  +    public void setMavenRepoRemotes( List mavenRepoRemote )
       {
  -        setVariable(MavenConstants.REPO_REMOTE, mavenRepoRemote);
  +        setVariable( MavenConstants.REPO_REMOTE, mavenRepoRemote );
       }
   
       /**
  @@ -1354,7 +1380,7 @@
       public List getMavenRepoRemote()
       {
           // We might have CSV list of remote repositories.
  -        return convertCsvStringToList((String) getVariable(MavenConstants.REPO_REMOTE));
  +        return convertCsvStringToList( (String) getVariable( MavenConstants.REPO_REMOTE ) );
       }
   
       /**
  @@ -1363,14 +1389,14 @@
        * @param csvString CVS list of values.
        * @return The List of value.
        */
  -    private List convertCsvStringToList(String csvString)
  +    private List convertCsvStringToList( String csvString )
       {
           ArrayList list = new ArrayList();
  -        String[] s = StringUtils.split(csvString, ",");
  +        String[] s = StringUtils.split( csvString, "," );
   
  -        for (int i = 0; i < s.length; i++)
  +        for ( int i = 0; i < s.length; i++ )
           {
  -            list.add(s[i]);
  +            list.add( s[i] );
           }
   
           return list;
  @@ -1381,9 +1407,9 @@
        *
        * @param mavenRepoLocal The local repository.
        */
  -    public void setMavenRepoLocal(String mavenRepoLocal)
  +    public void setMavenRepoLocal( String mavenRepoLocal )
       {
  -        setVariable(MavenConstants.REPO_LOCAL, mavenRepoLocal);
  +        setVariable( MavenConstants.REPO_LOCAL, mavenRepoLocal );
       }
   
       /**
  @@ -1393,7 +1419,7 @@
        */
       public String getMavenRepoLocal()
       {
  -        return (String) getVariable(MavenConstants.REPO_LOCAL);
  +        return (String) getVariable( MavenConstants.REPO_LOCAL );
       }
   
       /**
  @@ -1401,9 +1427,9 @@
        *
        * @param online The online flag.
        */
  -    public void setOnline(Boolean online)
  +    public void setOnline( Boolean online )
       {
  -        setVariable(MavenConstants.ONLINE, online);
  +        setVariable( MavenConstants.ONLINE, online );
       }
   
       /**
  @@ -1413,7 +1439,7 @@
        */
       public Boolean getOnline()
       {
  -        return getBoolean(MavenConstants.ONLINE);
  +        return getBoolean( MavenConstants.ONLINE );
       }
   
       /**
  @@ -1421,9 +1447,9 @@
        *
        * @param proxyHost The proxy host.
        */
  -    public void setProxyHost(String proxyHost)
  +    public void setProxyHost( String proxyHost )
       {
  -        setVariable(MavenConstants.PROXY_HOST, proxyHost);
  +        setVariable( MavenConstants.PROXY_HOST, proxyHost );
       }
   
       /**
  @@ -1433,7 +1459,7 @@
        */
       public String getProxyHost()
       {
  -        return (String) getVariable(MavenConstants.PROXY_HOST);
  +        return (String) getVariable( MavenConstants.PROXY_HOST );
       }
   
       /**
  @@ -1441,9 +1467,9 @@
        *
        * @param proxyPort The proxy port.
        */
  -    public void setProxyPort(String proxyPort)
  +    public void setProxyPort( String proxyPort )
       {
  -        setVariable(MavenConstants.PROXY_PORT, proxyPort);
  +        setVariable( MavenConstants.PROXY_PORT, proxyPort );
       }
   
       /**
  @@ -1453,7 +1479,7 @@
        */
       public String getProxyPort()
       {
  -        return (String) getVariable(MavenConstants.PROXY_PORT);
  +        return (String) getVariable( MavenConstants.PROXY_PORT );
       }
   
       /**
  @@ -1461,9 +1487,9 @@
        *
        * @param proxyUserName The user name setting for the proxy.
        */
  -    public void setProxyUserName(String proxyUserName)
  +    public void setProxyUserName( String proxyUserName )
       {
  -        setVariable(MavenConstants.PROXY_USERNAME, proxyUserName);
  +        setVariable( MavenConstants.PROXY_USERNAME, proxyUserName );
       }
   
       /**
  @@ -1473,7 +1499,7 @@
        */
       public String getProxyUserName()
       {
  -        return (String) getVariable(MavenConstants.PROXY_USERNAME);
  +        return (String) getVariable( MavenConstants.PROXY_USERNAME );
       }
   
       /**
  @@ -1481,9 +1507,9 @@
        *
        * @param proxyPassword The proxy password.
        */
  -    public void setProxyPassword(String proxyPassword)
  +    public void setProxyPassword( String proxyPassword )
       {
  -        setVariable(MavenConstants.PROXY_PASSWORD, proxyPassword);
  +        setVariable( MavenConstants.PROXY_PASSWORD, proxyPassword );
       }
   
       /**
  @@ -1493,7 +1519,7 @@
        */
       public String getProxyPassword()
       {
  -        return (String) getVariable(MavenConstants.PROXY_PASSWORD);
  +        return (String) getVariable( MavenConstants.PROXY_PASSWORD );
       }
   
       /**
  @@ -1501,9 +1527,9 @@
        *
        * @param remoteRepositoryEnabled Remote repository usage flag.
        */
  -    public void setRemoteRepositoryEnabled(Boolean remoteRepositoryEnabled)
  +    public void setRemoteRepositoryEnabled( Boolean remoteRepositoryEnabled )
       {
  -        setVariable(MavenConstants.REPO_REMOTE_ENABLED, remoteRepositoryEnabled);
  +        setVariable( MavenConstants.REPO_REMOTE_ENABLED, remoteRepositoryEnabled );
       }
   
       /**
  @@ -1513,7 +1539,7 @@
        */
       public Boolean getRemoteRepositoryEnabled()
       {
  -        return getBoolean(MavenConstants.REPO_REMOTE_ENABLED);
  +        return getBoolean( MavenConstants.REPO_REMOTE_ENABLED );
       }
   
       /**
  @@ -1521,9 +1547,9 @@
        *
        * @param mavenJarOverride MavenSession jar override flag.
        */
  -    public void setMavenJarOverride(Boolean mavenJarOverride)
  +    public void setMavenJarOverride( Boolean mavenJarOverride )
       {
  -        setVariable(MavenConstants.JAR_OVERRIDE, mavenJarOverride);
  +        setVariable( MavenConstants.JAR_OVERRIDE, mavenJarOverride );
       }
   
       /**
  @@ -1533,7 +1559,7 @@
        */
       public Boolean getMavenJarOverride()
       {
  -        return getBoolean(MavenConstants.JAR_OVERRIDE);
  +        return getBoolean( MavenConstants.JAR_OVERRIDE );
       }
   
       /**
  @@ -1542,56 +1568,18 @@
        * @param id Id of the project to override.
        * @return MavenSession jar override value for a particular dependency.
        */
  -    public String getMavenJarOverride(String id)
  -    {
  -        return (String) getVariable(MavenConstants.JAR_OVERRIDE_PROPERTY + id);
  -    }
  -
  -    private void setVariable(String key, Object value)
  +    public String getMavenJarOverride( String id )
       {
  -        getProperties().put(key, value);
  +        return (String) getVariable( MavenConstants.JAR_OVERRIDE_PROPERTY + id );
       }
   
  -    private Object getVariable(String key)
  +    private void setVariable( String key, Object value )
       {
  -        return getProperties().get(key);
  +        getProperties().put( key, value );
       }
   
  -    public void initialize()
  +    private Object getVariable( String key )
       {
  -        addProperty("maven.repo.local", System.getProperty("MAVEN_HOME") + "/repository");
  -        System.out.println("maven.repo.local=" + getMavenRepoLocal());
  -
  -        //We configure id, groupId, artifactId here now. It was an utter mess before
  -        String[] result = rejigIds(id, groupId, artifactId);
  -        id = result[0];
  -        groupId = result[1];
  -        artifactId = result[2];
  -
  -        //XXX componentify ArtifactListBuilder
  -        artifactList = ArtifactListBuilder.build(this);
  -    }
  -
  -    public static String[] rejigIds(String id, String groupId, String artifactId)
  -    {
  -        if (id != null && groupId == null && artifactId == null)
  -        {
  -            if (id.indexOf(':') >= 0)
  -            {
  -                int pos = id.indexOf(':');
  -                return new String[] { id, id.substring(0, pos), id.substring(pos + 1)};
  -                //throw new IllegalArgumentException("Do not use <id>groupId:artifactId</id>, use separate groupId / artifactId elements.");
  -            }
  -            DeprecationWarning.warn("Use of id is deprecated. Please use groupId / artifactId (id = " + id + ")");
  -            return new String[] { id + ":" + id, id, id };
  -        }
  -
  -        if (id == null && groupId != null && artifactId != null)
  -        {
  -            return new String[] { groupId + ":" + artifactId, groupId, artifactId };
  -        }
  -
  -        throw new IllegalArgumentException(
  -            "Incorrectly configured id/groupId/artifactId (" + id + "/" + groupId + "/" + artifactId + ")");
  +        return getProperties().get( key );
       }
   }
  
  
  

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