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/27 03:10:04 UTC
cvs commit: maven-new/core/src/test/org/apache/maven DefaultMavenTest.xml
bwalding 2003/04/26 18:10:04
Modified: core .cvsignore project.xml
core/src/java/org/apache/maven/plugin
DefaultPluginManager.java
core/src/java/org/apache/maven DefaultMaven.java
core/src/test/org/apache/maven/plugins/suiterunner
SuiteRunnerComponentTest.java
core/src/java/org/apache/maven/plugins/example
ExampleComponent.java
core/src/test/org/apache/maven DefaultMavenTest.xml
Added: core/src/java/org/apache/maven/classworld
ClassWorldService.java
DefaultClassWorldService.java
Log:
Upgrade to plexus SNAPSHOT (0.4 equivalent). Add ClassWorld service
Revision Changes Path
1.1 maven-new/core/src/java/org/apache/maven/classworld/ClassWorldService.java
Index: ClassWorldService.java
===================================================================
/*
* Created on 27/04/2003
*
* To change this generated comment go to
* Window>Preferences>Java>Code Generation>Code Template
*/
package org.apache.maven.classworld;
import com.werken.classworlds.ClassWorld;
/**
* @author <a href="bwalding@jakarta.org">Ben Walding</a>
* @version $Id: ClassWorldService.java,v 1.1 2003/04/27 01:10:03 bwalding Exp $
*/
public interface ClassWorldService
{
static String ROLE = ClassWorldService.class.getName();
ClassWorld getClassWorld();
}
1.1 maven-new/core/src/java/org/apache/maven/classworld/DefaultClassWorldService.java
Index: DefaultClassWorldService.java
===================================================================
package org.apache.maven.classworld;
/* ====================================================================
* 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/>.
*
* ====================================================================
*/
import org.apache.avalon.framework.activity.Initializable;
import org.apache.maven.DefaultMaven;
import com.werken.classworlds.ClassWorld;
/**
* @author <a href="bwalding@jakarta.org">Ben Walding</a>
* @version $Id: DefaultClassWorldService.java,v 1.1 2003/04/27 01:10:03 bwalding Exp $
*/
public class DefaultClassWorldService implements ClassWorldService, Initializable
{
private ClassWorld classWorld;
/**
* @see org.apache.avalon.framework.activity.Initializable#initialize()
*/
public void initialize() throws Exception
{
classWorld = new ClassWorld();
}
public ClassWorld getClassWorld() {
return classWorld;
}
}
1.2 +5 -0 maven-new/core/.cvsignore
Index: .cvsignore
===================================================================
RCS file: /home/cvs/maven-new/core/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 26 Apr 2003 23:33:30 -0000 1.1
+++ .cvsignore 27 Apr 2003 01:10:03 -0000 1.2
@@ -1 +1,6 @@
*.log
+target
+.classpath
+.project
+default.lst
+test.out
1.3 +1 -1 maven-new/core/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/maven-new/core/project.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- project.xml 26 Apr 2003 23:33:30 -0000 1.2
+++ project.xml 27 Apr 2003 01:10:03 -0000 1.3
@@ -340,7 +340,7 @@
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus</artifactId>
- <version>0.3</version>
+ <version>SNAPSHOT</version>
</dependency>
<dependency>
1.3 +11 -10 maven-new/core/src/java/org/apache/maven/plugin/DefaultPluginManager.java
Index: DefaultPluginManager.java
===================================================================
RCS file: /home/cvs/maven-new/core/src/java/org/apache/maven/plugin/DefaultPluginManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultPluginManager.java 26 Apr 2003 23:33:30 -0000 1.2
+++ DefaultPluginManager.java 27 Apr 2003 01:10:04 -0000 1.3
@@ -7,13 +7,13 @@
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
import org.apache.maven.Maven;
import org.apache.maven.plugins.suiterunner.DefaultSuiteRunnerPlugin;
import org.apache.maven.project.Project;
-import org.apache.plexus.context.DefaultPlexusContext;
+import org.apache.plexus.context.DefaultContext;
import org.apache.plexus.logging.AbstractLogEnabled;
-import org.apache.plexus.service.ServiceBroker;
-import org.apache.plexus.service.Serviceable;
import com.werken.werkz.Action;
import com.werken.werkz.CyclicGoalChainException;
@@ -23,7 +23,7 @@
public class DefaultPluginManager extends AbstractLogEnabled implements PluginManager, Serviceable
{
- private ServiceBroker serviceBroker;
+ private ServiceManager serviceManager;
/* (non-Javadoc)
* @see org.apache.maven.plugin.PluginManager#getPlugin(java.lang.String)
@@ -105,14 +105,13 @@
//attain the whole lot from the werkz project.
}
- /**
- * @see org.apache.plexus.service.Serviceable#service(org.apache.plexus.service.ServiceBroker)
- */
- final DefaultPlexusContext goalExecutionContext = new DefaultPlexusContext();
+ final DefaultContext goalExecutionContext = new DefaultContext();
final WerkzProject werkzProject = new WerkzProject();
- public void service(ServiceBroker serviceBroker) throws ServiceException
+
+ public void service(ServiceManager serviceManager) throws ServiceException
{
- this.serviceBroker = serviceBroker;
+ this.serviceManager = serviceManager;
+
//For each plugin
Iterator pluginIter = getPlugins().iterator();
@@ -169,4 +168,6 @@
//Need to perform a pre-requisite stage here also.
}
+
+
}
1.3 +20 -3 maven-new/core/src/java/org/apache/maven/DefaultMaven.java
Index: DefaultMaven.java
===================================================================
RCS file: /home/cvs/maven-new/core/src/java/org/apache/maven/DefaultMaven.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultMaven.java 26 Apr 2003 23:33:30 -0000 1.2
+++ DefaultMaven.java 27 Apr 2003 01:10:04 -0000 1.3
@@ -66,6 +66,7 @@
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
+import org.apache.maven.classworld.ClassWorldService;
import org.apache.maven.plugin.PluginManager;
import org.apache.maven.project.Project;
import org.apache.maven.project.builder.ProjectBuilder;
@@ -75,11 +76,13 @@
import org.apache.maven.verifier.LocalSettingsVerifier;
import org.apache.maven.verifier.RepoConfigException;
import org.apache.maven.verifier.UnsatisfiedDependencyException;
-import org.apache.plexus.context.DefaultPlexusContext;
+import org.apache.plexus.context.DefaultContext;
import org.apache.plexus.logging.AbstractLogEnabled;
import com.werken.classworlds.ClassRealm;
import com.werken.classworlds.ClassWorld;
+import com.werken.classworlds.DuplicateRealmException;
+import com.werken.classworlds.NoSuchRealmException;
import com.werken.werkz.NoActionDefinitionException;
import com.werken.werkz.UnattainableGoalException;
@@ -190,6 +193,7 @@
// Move the realm retrieval to an initialization phase. It
// doesn't belong here in the constructor.
+ // And shouldn't it be using the ClassWorldService?
try
{
@@ -211,6 +215,19 @@
dependencyVerifier = (DependencyVerifier) serviceManager.lookup(DependencyVerifier.ROLE);
localSettingsVerifier = (LocalSettingsVerifier) serviceManager.lookup(LocalSettingsVerifier.ROLE);
pluginManager = (PluginManager) serviceManager.lookup(PluginManager.ROLE);
+
+ ClassWorldService cws = (ClassWorldService) serviceManager.lookup(ClassWorldService.ROLE);
+ try {
+ rootClassRealm = cws.getClassWorld().getRealm(ROOT_REALM);
+ } catch (NoSuchRealmException nre) {
+ try {
+ rootClassRealm = cws.getClassWorld().newRealm(ROOT_REALM);
+ } catch (DuplicateRealmException dre) {
+ //We shouldn't be able to get here.
+ dre.printStackTrace();
+ }
+ }
+
}
/** Perform pre-build initialization.
@@ -533,7 +550,7 @@
public void attainGoals() throws UnknownGoalException, Exception
{
//FIXME BRW: Shouldn't be hardwired to plexus (I think)
- DefaultPlexusContext context = new DefaultPlexusContext();
+ DefaultContext context = new DefaultContext();
context.put(Project.CONTEXT_KEY, getRootProject());
getPluginManager().attainGoals(context, goals);
1.2 +3 -3 maven-new/core/src/test/org/apache/maven/plugins/suiterunner/SuiteRunnerComponentTest.java
Index: SuiteRunnerComponentTest.java
===================================================================
RCS file: /home/cvs/maven-new/core/src/test/org/apache/maven/plugins/suiterunner/SuiteRunnerComponentTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SuiteRunnerComponentTest.java 26 Apr 2003 16:52:14 -0000 1.1
+++ SuiteRunnerComponentTest.java 27 Apr 2003 01:10:04 -0000 1.2
@@ -12,7 +12,7 @@
import org.apache.maven.project.Project;
import org.apache.maven.project.builder.ProjectUnmarshaller;
import org.apache.plexus.PlexusTestCase;
-import org.apache.plexus.context.DefaultPlexusContext;
+import org.apache.plexus.context.DefaultContext;
/**
* @author <a href="bwalding@jakarta.org">Ben Walding</a>
@@ -59,7 +59,7 @@
SuiteRunnerPlugin srs = (SuiteRunnerPlugin) o;
assertNotNull("project", testProject);
- DefaultPlexusContext context = new DefaultPlexusContext();
+ DefaultContext context = new DefaultContext();
context.put("project", testProject);
srs.runTests(context);
}
1.3 +6 -5 maven-new/core/src/java/org/apache/maven/plugins/example/ExampleComponent.java
Index: ExampleComponent.java
===================================================================
RCS file: /home/cvs/maven-new/core/src/java/org/apache/maven/plugins/example/ExampleComponent.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExampleComponent.java 26 Apr 2003 23:33:31 -0000 1.2
+++ ExampleComponent.java 27 Apr 2003 01:10:04 -0000 1.3
@@ -66,7 +66,7 @@
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
-import org.apache.plexus.context.DefaultPlexusContext;
+import org.apache.plexus.context.DefaultContext;
import org.apache.plexus.logging.AbstractLogEnabled;
/** This service implements all the start phases:
@@ -117,11 +117,12 @@
{
System.out.println("ExampleComponent.contextualize()");
- if (context instanceof DefaultPlexusContext)
+ if (context instanceof DefaultContext)
{
- DefaultPlexusContext pcontext = (DefaultPlexusContext) context;
+ //DefaultContext pcontext = (DefaultContext) context;
System.out.println("Context: " + context);
- System.out.println("Context.getRootDirectory() : " + pcontext.getRootDirectory());
+ //XXX this has been broken in upgrade to plexus 0.4
+ //System.out.println("Context.getRootDirectory() : " + pcontext.getRootDirectory());
}
contextualize = true;
}
1.2 +12 -0 maven-new/core/src/test/org/apache/maven/DefaultMavenTest.xml
Index: DefaultMavenTest.xml
===================================================================
RCS file: /home/cvs/maven-new/core/src/test/org/apache/maven/DefaultMavenTest.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultMavenTest.xml 26 Apr 2003 16:52:16 -0000 1.1
+++ DefaultMavenTest.xml 27 Apr 2003 01:10:04 -0000 1.2
@@ -19,6 +19,18 @@
<configuration>
</configuration>
</component>
+
+ <!--
+ |
+ | ClassWorld
+ |
+ -->
+ <component>
+ <role>org.apache.maven.classworld.ClassWorldService</role>
+ <implementation>org.apache.maven.classworld.DefaultClassWorldService</implementation>
+ <configuration>
+ </configuration>
+ </component>
<!--
|
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org