dion 2002/06/20 18:43:22
Modified: src/java/org/apache/maven Build.java
Log:
moved property loading into configure rather than run
Revision Changes Path
1.15 +25 -14 jakarta-turbine-maven/src/java/org/apache/maven/Build.java
Index: Build.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/Build.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Build.java 20 Jun 2002 23:25:35 -0000 1.14
+++ Build.java 21 Jun 2002 01:43:22 -0000 1.15
@@ -81,6 +81,8 @@
import org.apache.maven.build.Repository;
import org.apache.maven.build.RepositoryManager;
+import org.xml.sax.SAXException;
+
/**
* The 'driver' for maven, in java form.
* This class looks after the following things:
@@ -123,7 +125,7 @@
/** used to handle properties */
private PropertyResolver resolver = new PropertyResolver();
/** log output */
- private static final Log log = org.apache.commons.logging.LogFactory.getLog(
+ private static final Log LOG = org.apache.commons.logging.LogFactory.getLog(
Build.class);
/** the repository manager to handle jar download etc */
private RepositoryManager repositoryManager = new RepositoryManager();
@@ -167,6 +169,7 @@
* @throws ParseException if args can't be parsed correctly
* @throws Exception if the project descriptor can't be converted to an
* object
+ * @task make default task parameterised?
*/
public void configure(String[] args) throws MissingArgumentException,
ParseException, Exception
@@ -187,6 +190,10 @@
setTasks(new ArrayList());
getTasks().add("jar");
}
+ LOG.info("Running maven-j with tasks: " + getTasks());
+ // load properties: system, user, build, project, maven defaults
+ LOG.info("Loading properties");
+ loadProperties();
}
catch (MissingOptionException moe)
{
@@ -205,12 +212,8 @@
public void run() throws IntrospectionException, FileNotFoundException,
IOException, Exception
{
- log.info("Running maven-j with tasks: " + getTasks());
- // load properties: system, user, build, project, maven defaults
- log.info("Loading properties");
- loadProperties();
// verify project is ok first
- log.info("Verifying project integrity");
+ LOG.info("Verifying project integrity");
verifyProject();
// resolve action to run
// execute action(s)
@@ -261,14 +264,14 @@
}
catch (FileNotFoundException fnfe)
{
- log.error("File not found",
+ LOG.error("File not found",
fnfe);
throw new RuntimeException("File not found loading properties - an"
+ " error has been logged");
}
catch (IOException ioe)
{
- log.error("Exception loading properties", ioe);
+ LOG.error("Exception loading properties", ioe);
throw new RuntimeException("I/O error loading properties - an " +
"error has been logged");
}
@@ -283,17 +286,23 @@
* </ol>
* </p>
*
- * @throws IntrospectionException if there are problems with the project
- * descriptor conversion
+ * @throws IntrospectionException if there are issues reading a
+ * {@link Project} object
+ * @throws FileNotFoundException when a file used is not available during
+ * formatting or transformation
+ * @throws IOException when errors occur reading or writing
+ * @throws SAXException when problems occur parsing XML
+ * @throws Exception when someother component fails
*/
public void verifyProject() throws IntrospectionException,
- FileNotFoundException, IOException, Exception
+ FileNotFoundException, IOException, SAXException, Exception
{
if (!getProjectDescriptor().getProject().isPomCurrent())
{
getProjectDescriptor().upgrade(getProperty("maven.home"));
}
+
Map failures = getRepositoryManager().updateJars(
getProjectDescriptor().getProject().getDependentJars());
if (failures.size() != 0)
@@ -303,7 +312,7 @@
while (keys.hasNext())
{
key = (String) keys.next();
- log.error(failures.get(key));
+ LOG.error(failures.get(key));
}
throw new IOException("Errors obtaining jars");
}
@@ -367,7 +376,9 @@
return options;
}
- /** provide access to the project descriptor
+ /**
+ * provide access to the project descriptor
+ *
* @return a project descriptor representing the maven project to be used
* for the build
*/
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>