jvanzyl 2004/05/27 13:03:47
Modified: maven-plugin/src/main/java/org/apache/maven/plugin/generator/jelly
JellyHarnessGenerator.java
Log:
o some poms have no stated deps
Revision Changes Path
1.7 +15 -10
maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/jelly/JellyHarnessGenerator.java
Index: JellyHarnessGenerator.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/jelly/JellyHarnessGenerator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JellyHarnessGenerator.java 27 May 2004 17:14:42 -0000 1.6
+++ JellyHarnessGenerator.java 27 May 2004 20:03:47 -0000 1.7
@@ -16,7 +16,7 @@
* @todo use the descriptions in the descriptor for the javadoc pushed into the
source code.
* @todo write plugin.properties (as a place holder, we don't technially need it)
* @todo convert POM or just strip out the dependencies to create a project.xml that
- * will serve as the trigger to download dependencies.
+ * will serve as the trigger to download dependencies.
*/
public class JellyHarnessGenerator
extends AbstractGenerator
@@ -147,7 +147,7 @@
if ( projectIndex > 0 )
{
- expression = expression.substring( 0, projectIndex ) + "pom" +
expression.substring( projectIndex + 7);
+ expression = expression.substring( 0, projectIndex ) + "pom" +
expression.substring( projectIndex + 7 );
}
if ( expression.startsWith( "#" ) )
@@ -204,19 +204,24 @@
{
writeDependency( w, "maven", "maven-plugin", "2.0-SNAPSHOT" );
- Xpp3Dom[] deps = pomDom.getChild( "dependencies" ).getChildren(
"dependency" );
+ Xpp3Dom depElement = pomDom.getChild( "dependencies" );
- for ( int i = 0; i < deps.length; i++ )
+ if ( depElement != null )
{
- Xpp3Dom dep = deps[i];
+ Xpp3Dom[] deps = depElement.getChildren( "dependency" );
- String groupId = dep.getChild( "artifactId" ).getValue();
+ for ( int i = 0; i < deps.length; i++ )
+ {
+ Xpp3Dom dep = deps[i];
+
+ String groupId = dep.getChild( "artifactId" ).getValue();
- String artifactId = dep.getChild( "groupId" ).getValue();
-
- String version = dep.getChild( "version" ).getValue();
+ String artifactId = dep.getChild( "groupId" ).getValue();
- writeDependency( w, groupId, artifactId, version );
+ String version = dep.getChild( "version" ).getValue();
+
+ writeDependency( w, groupId, artifactId, version );
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]