You are viewing a plain text version of this content. The canonical link for it is here.
Posted to alexandria-dev@jakarta.apache.org by jv...@apache.org on 2001/09/02 20:08:05 UTC
cvs commit: jakarta-alexandria/proposal/maven/src/java/org/apache/maven DependencyDescriptor.java
jvanzyl 01/09/02 11:08:05
Added: proposal/maven/src/java/org/apache/maven
DependencyDescriptor.java
Log:
- texen task to generate a dependency descriptor for a project/module
Revision Changes Path
1.1 jakarta-alexandria/proposal/maven/src/java/org/apache/maven/DependencyDescriptor.java
Index: DependencyDescriptor.java
===================================================================
package org.apache.maven;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
import org.apache.maven.bean.Profile;
import org.apache.maven.bean.Workspace;
import org.apache.maven.digester.WorkspaceDigester;
import org.apache.velocity.context.Context;
import org.apache.velocity.texen.ant.TexenTask;
import org.apache.log4j.Category;
import org.apache.log4j.PropertyConfigurator;
/**
* Task for controlling a multi-project build. The logic in
* this task will probably be placed in another core file and
* this task will be a wrapper around it. So that the build logic
* can be used in many interfaces: ant, command line, servlet ...
*
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @version $Id: DependencyDescriptor.java,v 1.1 2001/09/02 18:08:05 jvanzyl Exp $
*/
public class DependencyDescriptor
extends TexenTask
{
/**
* Workspace descriptor used to control a build session in
* in Maven.
*/
private File workspace;
/**
* Log4j category used for logging.
*/
private Category category = Category.getInstance(getClass().getName());
/**
* Set the workspace that will be used with this Maven
* build.
*
* @param File workspace descriptor
*/
public void setWorkspace(File workspace)
{
this.workspace = workspace;
}
/**
* Get the workspace descriptor being used with
* this Maven build.
*
* @return File workspace descriptor
*/
public File getWorkspace()
{
return workspace;
}
protected void populateInitialContext(Context context)
throws Exception
{
super.populateInitialContext(context);
// Setup log4j with a standard properties file.
PropertyConfigurator.configure("log4j.properties");
checkPrerequisites();
category.debug("Workspace file: " + workspace);
try
{
// Everything starts with a workspace.
WorkspaceDigester workspaceDigester = new WorkspaceDigester();
Workspace w = (Workspace) workspaceDigester.parse(workspace);
category.debug("Descriptor dir: " + w.getDescriptorDir());
category.debug("Work dir: " + w.getWorkDir());
w.process();
context.put("workspace", w);
}
catch(Exception e)
{
throw new Exception("Cannot process workspace!");
}
}
/**
* Make sure we have everything necessary for
* the maven build.
*/
private void checkPrerequisites()
throws Exception
{
// Make sure a workspace descriptor has been specified.
if (workspace == null)
{
throw new Exception("workspace attribute must be set!");
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: alexandria-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: alexandria-dev-help@jakarta.apache.org