You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by bw...@apache.org on 2003/04/25 11:05:55 UTC
cvs commit: maven-new/src/java/org/apache/maven/plugins/suiterunner DefaultSuiteRunnerPlugin.java
bwalding 2003/04/25 02:05:55
Modified: src/java/org/apache/maven/project Project.java
Dependency.java
src/java/org/apache/maven/project/builder
DefaultProjectUnmarshaller.java
ArtifactListBuilder.java
src/java/org/apache/maven/plugin Plugin.java
src/java/org/apache/maven MavenReturnCodes.java
src/java/org/apache/maven/plugins/suiterunner
DefaultSuiteRunnerPlugin.java
Added: src/java/org/apache/maven DeprecationWarning.java
Log:
Revision Changes Path
1.4 +220 -160 maven-new/src/java/org/apache/maven/project/Project.java
Index: Project.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/project/Project.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Project.java 25 Apr 2003 01:16:29 -0000 1.3
+++ Project.java 25 Apr 2003 09:05:54 -0000 1.4
@@ -56,8 +56,10 @@
* ====================================================================
*/
+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;
import java.io.File;
@@ -80,8 +82,7 @@
*
* @todo Change the file reference for the source POM to an URL.
*/
-public class Project
- extends BaseObject
+public class Project extends BaseObject
{
/** Project dependencies */
private List dependencies;
@@ -229,24 +230,10 @@
// ----------------------------------------------------------------------
// trying to align dep.id with project.id
+
public String getId()
{
- // The id has already been set.
- if ( id != null && id.indexOf( ":" ) > 0 )
- {
- return id;
- }
-
- // We want the artifact id to be the stated <id/>. Internally
- // the id consists of the groupId and stated <id/>.
- setArtifactId( id );
-
- if ( isValid( getGroupId() ) )
- {
- return getGroupId() + ":" + id;
- }
-
- return id + ":" + id;
+ return id;
}
/**
@@ -255,7 +242,7 @@
*
* @param artifactId The artifactId.
*/
- public void setArtifactId( String artifactId )
+ public void setArtifactId(String artifactId)
{
this.artifactId = artifactId;
}
@@ -275,7 +262,7 @@
*
* @param groupId Project group id.
*/
- public void setGroupId( String groupId )
+ public void setGroupId(String groupId)
{
this.groupId = groupId;
}
@@ -305,7 +292,7 @@
*
* @param artifactList
*/
- public void setArtifacts( List artifactList )
+ public void setArtifacts(List artifactList)
{
this.artifactList = artifactList;
}
@@ -325,7 +312,7 @@
*
* @param file POM file
*/
- public void setFile( File file )
+ public void setFile(File file)
{
this.file = file;
}
@@ -357,7 +344,7 @@
*
* @param parent
*/
- public void setParent( Project parent )
+ public void setParent(Project parent)
{
this.parent = parent;
}
@@ -367,7 +354,7 @@
*
* @param pomToExtend Project which this project extends.
*/
- public void setExtend( String pomToExtend )
+ public void setExtend(String pomToExtend)
{
this.pomToExtend = pomToExtend;
}
@@ -409,7 +396,7 @@
*/
public File parentMavenXml()
{
- return new File( getParent().getFile().getParentFile(), "maven.xml" );
+ return new File(getParent().getFile().getParentFile(), "maven.xml");
}
// ----------------------------------------------------------------------
@@ -421,7 +408,7 @@
*
* @param gumpRepositoryId Gump repository id.
*/
- public void setGumpRepositoryId( String gumpRepositoryId )
+ public void setGumpRepositoryId(String gumpRepositoryId)
{
this.gumpRepositoryId = gumpRepositoryId;
}
@@ -441,7 +428,7 @@
*
* @param shortDescription Short description of project.
*/
- public void setShortDescription( String shortDescription )
+ public void setShortDescription(String shortDescription)
{
this.shortDescription = shortDescription;
}
@@ -458,7 +445,7 @@
public String getArtifactDirectory()
{
- if ( isValid( getGroupId() ) )
+ if (isValid(getGroupId()))
{
return getGroupId();
}
@@ -466,7 +453,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());
}
/**
@@ -475,7 +462,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;
}
@@ -498,7 +485,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;
}
@@ -519,7 +506,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;
}
@@ -541,7 +528,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;
}
@@ -561,12 +548,12 @@
*
* @param dependency Dependency for this project.
*/
- public void addDependency( Dependency dependency )
+ public void addDependency(Dependency dependency)
{
- if ( !dependencies.contains( dependency ) )
+ if (!dependencies.contains(dependency))
{
- dependencies.add( dependency );
- dependencyMap.put( dependency.getId(), dependency );
+ dependencies.add(dependency);
+ dependencyMap.put(dependency.getId(), dependency);
}
}
@@ -575,7 +562,7 @@
*
* @param dependencies List of dependencies to add to the project.
*/
- public void setDependencies( List dependencies )
+ public void setDependencies(List dependencies)
{
this.dependencies = dependencies;
}
@@ -590,11 +577,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());
}
}
@@ -608,10 +595,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;
}
@@ -622,9 +609,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);
}
/**
@@ -633,9 +620,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));
}
/**
@@ -644,9 +631,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));
}
/**
@@ -654,11 +641,11 @@
*
* @param report report for this project.
*/
- public void addReport( String report )
+ public void addReport(String report)
{
- if ( reports.contains( report ) == false )
+ if (reports.contains(report) == false)
{
- reports.add( report );
+ reports.add(report);
}
}
@@ -667,7 +654,7 @@
*
* @param reports
*/
- public void setReports( List reports )
+ public void setReports(List reports)
{
this.reports = reports;
}
@@ -682,13 +669,12 @@
return reports;
}
-
/**
* Sets the build attribute of the Project object
*
* @param build the build environment of a project
*/
- public void setBuild( Build build )
+ public void setBuild(Build build)
{
this.build = build;
}
@@ -708,9 +694,9 @@
*
* @param mailingList Mailing list for this project.
*/
- public void addMailingList( MailingList mailingList )
+ public void addMailingList(MailingList mailingList)
{
- mailingLists.add( mailingList );
+ mailingLists.add(mailingList);
}
/**
@@ -718,7 +704,7 @@
*
* @param mailingLists Set the mailing lists for the project.
*/
- public void setMailingLists( List mailingLists )
+ public void setMailingLists(List mailingLists)
{
this.mailingLists = mailingLists;
}
@@ -738,9 +724,9 @@
*
* @param developer Developer for this project.
*/
- public void addDeveloper( Developer developer )
+ public void addDeveloper(Developer developer)
{
- developers.add( developer );
+ developers.add(developer);
}
/**
@@ -748,7 +734,7 @@
*
* @param developers Project developers.
*/
- public void setDevelopers( List developers )
+ public void setDevelopers(List developers)
{
this.developers = developers;
}
@@ -768,7 +754,7 @@
*
* @param contributors Contributors for this project.
*/
- public void setContributors( List contributors )
+ public void setContributors(List contributors)
{
this.contributors = contributors;
}
@@ -778,9 +764,9 @@
*
* @param contributor Contributor for this project.
*/
- public void addContributor( Contributor contributor )
+ public void addContributor(Contributor contributor)
{
- contributors.add( contributor );
+ contributors.add(contributor);
}
/**
@@ -798,7 +784,7 @@
*
* @param licenses Licenses for this project.
*/
- public void setLicenses( List licenses )
+ public void setLicenses(List licenses)
{
this.licenses = licenses;
}
@@ -808,9 +794,9 @@
*
* @param license License for this project.
*/
- public void addLicense( License license )
+ public void addLicense(License license)
{
- licenses.add( license );
+ licenses.add(license);
}
/**
@@ -828,7 +814,7 @@
*
* @param repository the repository this project is part of
*/
- public void setRepository( Repository repository )
+ public void setRepository(Repository repository)
{
this.repository = repository;
}
@@ -848,7 +834,7 @@
*
* @param url the URL to the organization's home page
*/
- public void setUrl( String url )
+ public void setUrl(String url)
{
this.url = url;
}
@@ -868,7 +854,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;
}
@@ -888,7 +874,7 @@
*
* @param description the long description of the project
*/
- public void setDescription( String description )
+ public void setDescription(String description)
{
this.description = description;
}
@@ -911,7 +897,7 @@
*/
public boolean hasRepository()
{
- return ( repository != null );
+ return (repository != null);
}
/**
@@ -920,7 +906,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;
}
@@ -941,7 +927,7 @@
*
* @param organization the organisation name
*/
- public void setOrganization( Organization organization )
+ public void setOrganization(Organization organization)
{
this.organization = organization;
}
@@ -962,7 +948,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;
}
@@ -983,7 +969,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;
}
@@ -1003,7 +989,7 @@
*
* @param pomVersion the new value
*/
- public void setPomVersion( String pomVersion )
+ public void setPomVersion(String pomVersion)
{
this.pomVersion = pomVersion;
}
@@ -1016,7 +1002,7 @@
*/
public String getPomVersion()
{
- if ( pomVersion == null )
+ if (pomVersion == null)
{
pomVersion = "1";
}
@@ -1032,7 +1018,7 @@
*/
public boolean isPomCurrent()
{
- return Integer.parseInt( getPomVersion() ) == MavenConstants.POM_VERSION;
+ return Integer.parseInt(getPomVersion()) == MavenConstants.POM_VERSION;
}
/**
@@ -1040,9 +1026,9 @@
*
* @param version Distribution for this project.
*/
- public void addVersion( Version version )
+ public void addVersion(Version version)
{
- versions.add( version );
+ versions.add(version);
}
/**
@@ -1050,7 +1036,7 @@
*
* @param versions List of versions for this project.
*/
- public void setVersions( List versions )
+ public void setVersions(List versions)
{
this.versions = versions;
}
@@ -1071,23 +1057,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);
}
/**
@@ -1095,7 +1081,7 @@
*
* @param logo the url for the project logo image.
*/
- public void setLogo( String logo )
+ public void setLogo(String logo)
{
this.logo = logo;
}
@@ -1126,7 +1112,7 @@
*
* @param packageGroups is the list of PackageGroup instances
*/
- public void setPackageGroups( List packageGroups )
+ public void setPackageGroups(List packageGroups)
{
this.packageGroups = packageGroups;
}
@@ -1137,9 +1123,9 @@
* @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 );
+ packageGroups.add(packageGroup);
}
// ----------------------------------------------------------------------
@@ -1157,7 +1143,7 @@
*
* @param dependencyClasspath Dependency classpath.
*/
- public void setDependencyClasspath( String dependencyClasspath )
+ public void setDependencyClasspath(String dependencyClasspath)
{
this.dependencyClasspath = dependencyClasspath;
}
@@ -1188,9 +1174,9 @@
*
* @param goals Goals to be satisfied.
*/
- public void setGoalNames( List goals )
+ public void setGoalNames(List goals)
{
- getGoalNames().addAll( goals );
+ getGoalNames().addAll(goals);
}
/**
@@ -1198,15 +1184,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());
}
}
}
@@ -1229,19 +1215,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;
}
@@ -1263,13 +1249,18 @@
* @param id
* @return
*/
- public static String standardToLegacyId( String id )
+ public static String standardToLegacyId(String id)
{
- int i = id.indexOf( ":" );
+ if (id == null)
+ {
+ throw new NullPointerException("Project.standardToLegacyId does not accept id == null");
+ }
+
+ int i = id.indexOf(":");
- if ( i > 0 )
+ if (i > 0)
{
- id = id.substring( i + 1 );
+ id = id.substring(i + 1);
}
return id;
@@ -1289,23 +1280,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;
}
@@ -1322,9 +1311,9 @@
*
* @param mavenSession
*/
- public void setMaven( Maven mavenSession )
+ public void setMaven(Maven mavenSession)
{
- setVariable( MavenConstants.SESSION, mavenSession );
+ setVariable(MavenConstants.SESSION, mavenSession);
}
/**
@@ -1334,7 +1323,7 @@
*/
public Maven getMaven()
{
- return (Maven) getVariable( MavenConstants.SESSION );
+ return (Maven) getVariable(MavenConstants.SESSION);
}
/**
@@ -1342,9 +1331,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);
}
/**
@@ -1352,9 +1341,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);
}
/**
@@ -1365,7 +1354,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));
}
/**
@@ -1374,14 +1363,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;
@@ -1392,9 +1381,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);
}
/**
@@ -1404,7 +1393,7 @@
*/
public String getMavenRepoLocal()
{
- return (String) getVariable( MavenConstants.REPO_LOCAL );
+ return (String) getVariable(MavenConstants.REPO_LOCAL);
}
/**
@@ -1412,9 +1401,9 @@
*
* @param online The online flag.
*/
- public void setOnline( Boolean online )
+ public void setOnline(Boolean online)
{
- setVariable( MavenConstants.ONLINE, online );
+ setVariable(MavenConstants.ONLINE, online);
}
/**
@@ -1424,18 +1413,17 @@
*/
public Boolean getOnline()
{
- return getBoolean( MavenConstants.ONLINE );
+ return getBoolean(MavenConstants.ONLINE);
}
-
/**
* Set the proxy host.
*
* @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);
}
/**
@@ -1445,7 +1433,7 @@
*/
public String getProxyHost()
{
- return (String) getVariable( MavenConstants.PROXY_HOST );
+ return (String) getVariable(MavenConstants.PROXY_HOST);
}
/**
@@ -1453,9 +1441,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);
}
/**
@@ -1465,7 +1453,7 @@
*/
public String getProxyPort()
{
- return (String) getVariable( MavenConstants.PROXY_PORT );
+ return (String) getVariable(MavenConstants.PROXY_PORT);
}
/**
@@ -1473,9 +1461,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);
}
/**
@@ -1485,7 +1473,7 @@
*/
public String getProxyUserName()
{
- return (String) getVariable( MavenConstants.PROXY_USERNAME );
+ return (String) getVariable(MavenConstants.PROXY_USERNAME);
}
/**
@@ -1493,9 +1481,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);
}
/**
@@ -1505,7 +1493,7 @@
*/
public String getProxyPassword()
{
- return (String) getVariable( MavenConstants.PROXY_PASSWORD );
+ return (String) getVariable(MavenConstants.PROXY_PASSWORD);
}
/**
@@ -1513,9 +1501,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);
}
/**
@@ -1525,7 +1513,7 @@
*/
public Boolean getRemoteRepositoryEnabled()
{
- return getBoolean( MavenConstants.REPO_REMOTE_ENABLED );
+ return getBoolean(MavenConstants.REPO_REMOTE_ENABLED);
}
/**
@@ -1533,9 +1521,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);
}
/**
@@ -1545,7 +1533,7 @@
*/
public Boolean getMavenJarOverride()
{
- return getBoolean( MavenConstants.JAR_OVERRIDE );
+ return getBoolean(MavenConstants.JAR_OVERRIDE);
}
/**
@@ -1554,18 +1542,90 @@
* @param id Id of the project to override.
* @return MavenSession jar override value for a particular dependency.
*/
- public String getMavenJarOverride( String id )
+ public String getMavenJarOverride(String id)
+ {
+ return (String) getVariable(MavenConstants.JAR_OVERRIDE_PROPERTY + id);
+ }
+
+ private void setVariable(String key, Object value)
+ {
+ getProperties().put(key, value);
+ }
+
+ private Object getVariable(String key)
{
- return (String) getVariable( MavenConstants.JAR_OVERRIDE_PROPERTY + id );
+ return getProperties().get(key);
}
- private void setVariable( String key, Object value )
+ public void initialize()
{
- getProperties().put( key, value );
+ //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);
}
- private Object getVariable( String key )
+ public static String[] rejigIds(String id, String groupId, String artifactId)
{
- return getProperties().get( key );
+
+ if (id == null && groupId == null && artifactId == null)
+ {
+ throw new IllegalArgumentException("Incorrectly configured id/groupId/artifactId");
+ }
+
+ if (id == null && groupId == null && artifactId != null)
+ {
+ throw new IllegalArgumentException("Incorrectly configured id/groupId/artifactId");
+ }
+
+ if (id == null && groupId != null && artifactId == null)
+ {
+ throw new IllegalArgumentException("Incorrectly configured id/groupId/artifactId");
+ }
+
+ if (id == null && groupId != null && artifactId != null)
+ {
+ return new String[] { groupId + ":" + artifactId, groupId, artifactId };
+ }
+
+ if (id != null && groupId == null && artifactId == null)
+ {
+ int pos = id.indexOf(':');
+
+ if (pos < 0)
+ {
+ return new String[] { id + ":" + id, id, id };
+ }
+ return new String[] { id, id.substring(0, pos), id.substring(pos + 1)};
+ }
+
+ if (id != null && groupId == null && artifactId != null)
+ {
+ if (id.equals(artifactId)) {
+ DeprecationWarning.warn("Do not use id + artifactId, use groupId + artifactId");
+ return new String[] { id + ":" + artifactId, id, artifactId };
+ }
+ throw new IllegalArgumentException("Incorrectly configured id/groupId/artifactId");
+ }
+
+ if (id != null && groupId != null && artifactId == null)
+ {
+ if (id.equals(groupId)) {
+ DeprecationWarning.warn("Do not use groupId + id, use groupId + artifactId");
+ return new String[] { groupId + ":" + id, groupId, id };
+ }
+ throw new IllegalArgumentException("Incorrectly configured id/groupId/artifactId");
+ }
+
+ if (id != null && groupId != null && artifactId != null)
+ {
+ throw new IllegalArgumentException("Incorrectly configured id/groupId/artifactId");
+ }
+
+ throw new IllegalStateException("Somehow got through all the if statements. Bad. Very bad.");
}
}
1.2 +6 -1 maven-new/src/java/org/apache/maven/project/Dependency.java
Index: Dependency.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/project/Dependency.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Dependency.java 15 Apr 2003 01:16:35 -0000 1.1
+++ Dependency.java 25 Apr 2003 09:05:54 -0000 1.2
@@ -147,6 +147,11 @@
return getGroupId() + ":" + getArtifactId();
}
+
+ if (id == null) {
+ System.out.println("ERROR: Somehow you've managed to set the ID of dep(" + getGroupId() + ":" + getArtifactId() + " to null");
+ }
+
return id;
}
1.3 +8 -2 maven-new/src/java/org/apache/maven/project/builder/DefaultProjectUnmarshaller.java
Index: DefaultProjectUnmarshaller.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/project/builder/DefaultProjectUnmarshaller.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultProjectUnmarshaller.java 25 Apr 2003 02:16:02 -0000 1.2
+++ DefaultProjectUnmarshaller.java 25 Apr 2003 09:05:55 -0000 1.3
@@ -1,5 +1,6 @@
package org.apache.maven.project.builder;
+import org.apache.maven.DeprecationWarning;
import org.apache.maven.project.Build;
import org.apache.maven.project.Contributor;
import org.apache.maven.project.Dependency;
@@ -161,6 +162,7 @@
{
if (parser.getName().equals("id"))
{
+ DeprecationWarning.warn("The use of id is deprecated. Please use groupId + artifactId");
v.setId(parser.nextText());
}
else if (parser.getName().equals("name"))
@@ -326,6 +328,10 @@
{
d.setArtifactId(parser.nextText());
}
+ else if (parser.getName().equals("id"))
+ {
+ d.setId(parser.nextText());
+ }
else if (parser.getName().equals("version"))
{
d.setVersion(parser.nextText());
@@ -464,7 +470,7 @@
eventType = parser.next();
}
-
+ project.initialize();
return project;
}
1.2 +5 -1 maven-new/src/java/org/apache/maven/project/builder/ArtifactListBuilder.java
Index: ArtifactListBuilder.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/project/builder/ArtifactListBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ArtifactListBuilder.java 15 Apr 2003 01:16:39 -0000 1.1
+++ ArtifactListBuilder.java 25 Apr 2003 09:05:55 -0000 1.2
@@ -88,6 +88,10 @@
for ( Iterator i = project.getDependencies().iterator(); i.hasNext(); )
{
Dependency d = (Dependency) i.next();
+ if (d.getId() == null) {
+
+ }
+
String mavenJarProperty = project.getMavenJarOverride( Project.standardToLegacyId( d.getId() ) );
Artifact artifact = DefaultArtifactFactory.createArtifact( d );
1.3 +3 -3 maven-new/src/java/org/apache/maven/plugin/Plugin.java
Index: Plugin.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/plugin/Plugin.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Plugin.java 25 Apr 2003 01:16:30 -0000 1.2
+++ Plugin.java 25 Apr 2003 09:05:55 -0000 1.3
@@ -71,8 +71,8 @@
public interface Plugin
{
/**
- * @see org.apache.maven.plugin.Goal
- * @return a List of Goal objects
+ * @see org.apache.maven.plugin.PluginGoal
+ * @return a List of PluginGoal objects
*/
public List getGoals();
public void runGoal(String goal, Context context) throws Exception;
1.3 +3 -1 maven-new/src/java/org/apache/maven/MavenReturnCodes.java
Index: MavenReturnCodes.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/MavenReturnCodes.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MavenReturnCodes.java 25 Apr 2003 01:16:30 -0000 1.2
+++ MavenReturnCodes.java 25 Apr 2003 09:05:55 -0000 1.3
@@ -77,4 +77,6 @@
/** return code for a failure due to anything else */
public static final int RC_OTHER_FAILURE = 90;
+ /** return code for use of a completely deprecated item - eg. you must not be using it anymore */
+ public static final int RC_DEPRECATED = 100;
}
1.1 maven-new/src/java/org/apache/maven/DeprecationWarning.java
Index: DeprecationWarning.java
===================================================================
package org.apache.maven;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
/**
* @author <a href="bwalding@jakarta.org">Ben Walding</a>
* @version $Id: DeprecationWarning.java,v 1.1 2003/04/25 09:05:55 bwalding Exp $
*/
public class DeprecationWarning
{
public static final void warn(String message)
{
System.out.println("*DEPRECATION WARNING************************************");
System.out.println("* " + message);
System.out.println("*DEPRECATION WARNING************************************");
}
public static final void fail(String message)
{
System.out.println("*DEPRECATION FAILURE************************************");
System.out.println("* " + message);
System.out.println("*DEPRECATION FAILURE************************************");
System.exit(MavenReturnCodes.RC_DEPRECATED);
}
}
1.2 +92 -6 maven-new/src/java/org/apache/maven/plugins/suiterunner/DefaultSuiteRunnerPlugin.java
Index: DefaultSuiteRunnerPlugin.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/plugins/suiterunner/DefaultSuiteRunnerPlugin.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultSuiteRunnerPlugin.java 25 Apr 2003 02:16:02 -0000 1.1
+++ DefaultSuiteRunnerPlugin.java 25 Apr 2003 09:05:55 -0000 1.2
@@ -6,9 +6,16 @@
*/
package org.apache.maven.plugins.suiterunner;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
+import java.util.Properties;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.activity.Startable;
@@ -16,13 +23,13 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.maven.plugin.PluginGoal;
import org.apache.maven.project.Project;
+import org.apache.maven.repository.Artifact;
import org.apache.plexus.logging.AbstractLogEnabled;
/** This service implements all the start phases:
@@ -129,12 +136,90 @@
/* (non-Javadoc)
* @see org.apache.maven.plugins.suiterunner.SuiteRunnerService#runTests(java.lang.String, org.apache.maven.project.Project)
*/
- public void runTests(Context context) throws ContextException
+ public void runTests(Context context) throws Exception
{
//Use the POM etc to locate and run the tests
Project project = (Project) context.get(Project.CONTEXT_KEY);
System.out.println("Running tests for project(id = " + project.getId() + ")");
+ //UnitTest unitTest = project.getBuild().getUnitTest();
+
+ //The includes and excludes are not really suitable for us...
+ //FIXME actually use the include / excludes
+ //Need to use the Ant filescanner
+
+ //We'll just spit out a recipe file and then fork java and run SuiteRunner
+ //FORK ONCE ONLY! Speedy!
+ //XXX hardwired to target
+ File recipeFile = new File(System.getProperty("basedir") + "/target/" + project.getArtifactId() + ".srj");
+ FileOutputStream fos = null;
+ try
+ {
+ Properties p = new Properties();
+ //XXX hardwired to target/classes
+ p.put("org.suiterunner.Runpath", "-p \"target/classes\"");
+ p.put("org.suiterunner.Suites", "-s org.apache.maven.DefaultMavenTest");
+ p.put("org.suiterunner.Reporters", "-g -f test.out -eFAB");
+ fos = new FileOutputStream(recipeFile);
+ p.store(
+ fos,
+ "Maven generate SuiteRunner recipe file for "
+ + project.getArtifactId()
+ + " project (http://www.artima.com/suiterunner/)");
+ }
+ finally
+ {
+ if (fos != null)
+ {
+ fos.close();
+ }
+ }
+
+ Runtime r = Runtime.getRuntime();
+ //XXX fixme should have better way of specifying the jvm to use
+ //XXX should delegate to the java plugin's launcher
+ String MAVEN_HOME = System.getProperty("MAVEN_HOME");
+ String suiteRunner = MAVEN_HOME + "/repository/suiterunner/jars/suiterunner-1.0beta6.jar";
+ //XXX shouldn't be wired to current working dir
+ String JAVA_HOME = System.getProperty("sun.boot.library.path");
+ System.out.println(System.getProperties());
+
+ String classpath = "target/maven.jar";
+
+ List artifacts = project.getArtifacts();
+ if (artifacts != null)
+ {
+ Iterator iter = artifacts.iterator();
+ while (iter.hasNext())
+ {
+ Artifact arti = (Artifact) iter.next();
+ classpath += ";" + arti.getFile().getAbsolutePath();
+ }
+ }
+ System.out.println("ClassPath:" + classpath);
+
+ String cmd[] = { JAVA_HOME + "/java.exe", "-cp", classpath, "-jar", suiteRunner, recipeFile.getAbsolutePath()};
+
+ for (int i = 0; i < cmd.length; i++)
+ {
+ System.out.println("cmd[" + i + "] = " + cmd[i]);
+ }
+
+ Process p = r.exec(cmd, new String[0], new File("."));
+
+ InputStream is = p.getInputStream();
+ BufferedReader br = new BufferedReader(new InputStreamReader(is));
+ while (true)
+ {
+ String line = br.readLine();
+ if (line == null)
+ {
+ break;
+ }
+ System.out.println("SuiteRunner:" + line);
+ }
+ System.out.println("Exited with value: " + p.exitValue());
+
}
/**
@@ -143,7 +228,8 @@
private List goals;
public synchronized List getGoals()
{
- if (goals == null) {
+ if (goals == null)
+ {
//Why the hell wasn't that run as part of the lifecycle?
System.out.println("Initialize wasn't run as part of ocmponent lifecycle");
try
@@ -154,7 +240,7 @@
{
e.printStackTrace();
throw new RuntimeException(e.getLocalizedMessage());
-
+
}
}
return this.goals;
@@ -163,7 +249,7 @@
/* (non-Javadoc)
* @see org.apache.maven.plugin.PluginService#runGoal(java.lang.String)
*/
- public void runGoal(String goal, Context context) throws ContextException
+ public void runGoal(String goal, Context context) throws Exception
{
if ("suiterunner:test".equals(goal))
{
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
RE: cvs commit: maven-new/src/java/org/apache/maven/plugins/suiterunner DefaultSuiteRunnerPlugin.java
Posted by Vincent Massol <vm...@pivolis.com>.
Hi Ben,
I have to agree with dIon... cvs commit logs are a must... Hey, look at
it the positive way: there are people interested in what you're doing!
:-)
-Vincent
> -----Original Message-----
> From: Ben Walding [mailto:default0001@walding.com]
> Sent: 28 April 2003 12:38
> To: Maven Developers List
> Subject: Re: cvs commit: maven-
> new/src/java/org/apache/maven/plugins/suiterunner
> DefaultSuiteRunnerPlugin.java
>
> You miss commenting a few hundred commits and look at what happens...
> attack of the psycho CVS fascist!
>
> :P
>
> dion@multitask.com.au wrote:
>
> >Messages detailing what is committed would be nice :)
> >--
> >dIon Gillard, Multitask Consulting
> >Blog: http://www.freeroller.net/page/dion/Weblog
> >Work: http://www.multitask.com.au
> >
> >
> >bwalding@apache.org wrote on 25/04/2003 07:05:55 PM:
> >
> >
> >
> >>bwalding 2003/04/25 02:05:55
> >>
> >> Modified: src/java/org/apache/maven/project Project.java
> >> Dependency.java
> >> src/java/org/apache/maven/project/builder
> >> DefaultProjectUnmarshaller.java
> >> ArtifactListBuilder.java
> >> src/java/org/apache/maven/plugin Plugin.java
> >> src/java/org/apache/maven MavenReturnCodes.java
> >> src/java/org/apache/maven/plugins/suiterunner
> >> DefaultSuiteRunnerPlugin.java
> >> Added: src/java/org/apache/maven DeprecationWarning.java
> >> Log:
> >>
> >>
> >> Revision Changes Path
> >> 1.4 +220 -160
> >>
> >>
> >maven-new/src/java/org/apache/maven/project/Project.java
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: cvs commit: maven-new/src/java/org/apache/maven/plugins/suiterunner
DefaultSuiteRunnerPlugin.java
Posted by Ben Walding <de...@walding.com>.
You miss commenting a few hundred commits and look at what happens...
attack of the psycho CVS fascist!
:P
dion@multitask.com.au wrote:
>Messages detailing what is committed would be nice :)
>--
>dIon Gillard, Multitask Consulting
>Blog: http://www.freeroller.net/page/dion/Weblog
>Work: http://www.multitask.com.au
>
>
>bwalding@apache.org wrote on 25/04/2003 07:05:55 PM:
>
>
>
>>bwalding 2003/04/25 02:05:55
>>
>> Modified: src/java/org/apache/maven/project Project.java
>> Dependency.java
>> src/java/org/apache/maven/project/builder
>> DefaultProjectUnmarshaller.java
>> ArtifactListBuilder.java
>> src/java/org/apache/maven/plugin Plugin.java
>> src/java/org/apache/maven MavenReturnCodes.java
>> src/java/org/apache/maven/plugins/suiterunner
>> DefaultSuiteRunnerPlugin.java
>> Added: src/java/org/apache/maven DeprecationWarning.java
>> Log:
>>
>>
>> Revision Changes Path
>> 1.4 +220 -160
>>
>>
>maven-new/src/java/org/apache/maven/project/Project.java
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>For additional commands, e-mail: dev-help@maven.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: cvs commit: maven-new/src/java/org/apache/maven/plugins/suiterunner
DefaultSuiteRunnerPlugin.java
Posted by di...@multitask.com.au.
Messages detailing what is committed would be nice :)
--
dIon Gillard, Multitask Consulting
Blog: http://www.freeroller.net/page/dion/Weblog
Work: http://www.multitask.com.au
bwalding@apache.org wrote on 25/04/2003 07:05:55 PM:
> bwalding 2003/04/25 02:05:55
>
> Modified: src/java/org/apache/maven/project Project.java
> Dependency.java
> src/java/org/apache/maven/project/builder
> DefaultProjectUnmarshaller.java
> ArtifactListBuilder.java
> src/java/org/apache/maven/plugin Plugin.java
> src/java/org/apache/maven MavenReturnCodes.java
> src/java/org/apache/maven/plugins/suiterunner
> DefaultSuiteRunnerPlugin.java
> Added: src/java/org/apache/maven DeprecationWarning.java
> Log:
>
>
> Revision Changes Path
> 1.4 +220 -160
maven-new/src/java/org/apache/maven/project/Project.java
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org