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 2002/12/01 05:33:56 UTC
cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/app Maven.java
jvanzyl 2002/11/30 20:33:56
Modified: src/java/org/apache/maven/app Maven.java
Log:
refactoring
Revision Changes Path
1.145 +9 -131 jakarta-turbine-maven/src/java/org/apache/maven/app/Maven.java
Index: Maven.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/Maven.java,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -r1.144 -r1.145
--- Maven.java 30 Nov 2002 17:17:47 -0000 1.144
+++ Maven.java 1 Dec 2002 04:33:56 -0000 1.145
@@ -59,7 +59,6 @@
import com.werken.werkz.Goal;
import com.werken.werkz.Session;
import org.apache.commons.grant.GrantProject;
-import org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.tags.ant.AntTagLibrary;
import org.apache.commons.jelly.tags.jeez.JeezTagLibrary;
import org.apache.commons.jelly.tags.werkz.JellyBuildListener;
@@ -73,7 +72,6 @@
import org.apache.maven.jelly.MavenJellyContext;
import org.apache.maven.jelly.tags.MavenJeezTagLibrary;
import org.apache.maven.jelly.tags.project.MavenTagLibrary;
-import org.apache.maven.project.Project;
import org.apache.tools.ant.DemuxOutputStream;
import java.io.File;
@@ -138,24 +136,12 @@
// I N S T A N C E M E M B E R S
// ------------------------------------------------------------
- /** Project directory. */
- private File dir;
-
- /** ${basedir}/build.maven file (or null). */
- private File projectBuildFile;
-
/** List of string goal names on the command-line. */
private List goalNames;
- /** Maven project. */
- private Project project;
-
/** Jelly conext. */
private MavenJellyContext context;
- /** Produce logging information without adornments */
- private boolean emacsMode = false;
-
// ------------------------------------------------------------
// C O N S T R U C T O R S
// ------------------------------------------------------------
@@ -170,59 +156,6 @@
// A C C E S S O R S
// ------------------------------------------------------------
- /** Set the project-specific build file.
- *
- * @see #hasProjectBuildFile
- *
- * @param projectBuildFile The project-specific build file.
- */
- public void setProjectBuildFile( File projectBuildFile )
- {
- this.projectBuildFile = projectBuildFile;
- }
-
- /** Retrieve the project-specific build file.
- *
- * @return The project-specific build file if
- * one exists, otherwise <code>null</code>.
- */
- public File getProjectBuildFile()
- {
- return projectBuildFile;
- }
-
- /** Determine if the project has a project-specific
- * build file.
- *
- * @see #getProjectBuildFile
- *
- * @return <code>true</code> if a project-specific
- * build file exists, otherwise <code>false</code>.
- */
- public boolean hasProjectBuildFile()
- {
- return ( this.projectBuildFile != null );
- }
-
- /**
- * Get the project.
- *
- * @param project The Maven project.
- */
- public void setProject( Project project )
- {
- this.project = project;
- }
-
- /** Retrieve the maven <code>project</code>.
- *
- * @return The project descriptor.
- */
- public Project getProject()
- {
- return this.project;
- }
-
/** Retrieve the Ant project.
*
* NOTE: public for xdoc plugin, can be reverted to private when
@@ -245,35 +178,6 @@
getContext().setAntProject( antProject );
}
- /** Set the project directory.
- *
- * @param dir The project directory.
- */
- public void setDir( File dir )
- {
- this.dir = dir;
-
- if (dir != null)
- {
- System.setProperty( "user.dir", dir.getPath() );
- setProjectBuildFile( new File( dir, PROJECT_BUILD_FILE_NAME ) );
- }
- }
-
- /** Retrieve the project directory.
- *
- * @return The project directory.
- */
- public File getDir()
- {
- if ( dir == null )
- {
- this.dir = new File( System.getProperty( "user.dir" ) );
- }
-
- return this.dir;
- }
-
/** Retrieve the list of goal names.
*
* @return The list of goal names.
@@ -333,26 +237,6 @@
return context;
}
- /**
- * Set the emacsMode flag.
- *
- * @param emacsMode Emacs output mode.
- */
- public void setEmacsMode( boolean emacsMode )
- {
- this.emacsMode = emacsMode;
- }
-
- /**
- * Get the emacsMode flag.
- *
- * @return Emacs output mode.
- */
- public boolean getEmacsMode()
- {
- return emacsMode;
- }
-
// ------------------------------------------------------------
// I M P L E M E N T A T I O N
// ------------------------------------------------------------
@@ -375,7 +259,7 @@
// values can be made available in the plugin.jelly script.
CreateDependencyClasspath cdc = new CreateDependencyClasspath();
cdc.setRefid( "maven.dependency.classpath" );
- cdc.setMavenProject( getProject() );
+ //cdc.setMavenProject( getProject() );
cdc.setContext( getContext() );
cdc.execute();
@@ -396,7 +280,7 @@
getAntProject().setPropsHandler( new JellyPropsHandler( getContext() ) );
getAntProject().init();
- getAntProject().setBaseDir( getDir() );
+ getAntProject().setBaseDir( getContext().getDescriptorDirectory() );
getAntProject().getBaseDir();
PrintStream demuxOut =
@@ -417,19 +301,12 @@
public void initializeJelly()
throws Exception
{
- getContext().setVariable( MavenConstants.MAVEN_OBJECT, this );
+ getContext().setMaven( this );
getContext().setWerkzProject ( new com.werken.werkz.Project() );
- getContext().setProject( getProject() );
-
- if ( hasProjectBuildFile() )
- {
- getContext().setVariable( MavenConstants.MAVEN_BUILD_FILE_URL,
- getProjectBuildFile().toURL() );
- }
JellyBuildListener listener = new JellyBuildListener( getContext().getXMLOutput() );
listener.isDebug( getContext().getDebugOn().booleanValue() );
- listener.setEmacsMode( emacsMode );
+ listener.setEmacsMode( getContext().getEmacsModeOn().booleanValue() );
getAntProject().addBuildListener( listener );
@@ -524,7 +401,6 @@
try
{
INSTANCES.push( this );
- JellyContext context = getContext();
getContext().setVariable( MavenConstants.MAVEN_GOALS, getGoalNames() );
runGoals( goalNames );
}
@@ -542,13 +418,15 @@
private void loadProjectBuildFile()
throws Exception
{
- File projectBuildFile = getProjectBuildFile();
+ File projectBuildFile = new File ( getContext().getDescriptorDirectory(),
+ PROJECT_BUILD_FILE_NAME );
- if ( !projectBuildFile.exists() )
+ if ( projectBuildFile.exists() == false )
{
return;
}
+ getContext().setBuildFile( projectBuildFile );
getContext().getPluginManager().loadProjectBuildFile( projectBuildFile );
}