shuber 2005/05/30 16:20:08 CEST
Modified files:
. project.xml
src/java/org/jahia/tomcat/jasper JasperLaunch.java
Log:
Added support for Tomcat 5.5. New dependency on Ant was introduced.
Revision Changes Path
1.8 +4 -0 maven-jahiawar-plugin/project.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/maven-jahiawar-plugin/project.xml.diff?r1=1.7&r2=1.8&f=h
1.3 +22 -0
maven-jahiawar-plugin/src/java/org/jahia/tomcat/jasper/JasperLaunch.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/maven-jahiawar-plugin/src/java/org/jahia/tomcat/jasper/JasperLaunch.java.diff?r1=1.2&r2=1.3&f=h
Index: project.xml
===================================================================
RCS file: /home/cvs/repository/maven-jahiawar-plugin/project.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- project.xml 13 Oct 2004 17:14:42 -0000 1.7
+++ project.xml 30 May 2005 14:20:08 -0000 1.8
@@ -26,6 +26,10 @@
<version>1.0</version>
</dependency>
<dependency>
+ <id>ant</id>
+ <version>1.6.4</version>
+ </dependency>
+ <dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils-core</artifactId>
<version>1.7.0</version>
Index: JasperLaunch.java
===================================================================
RCS file:
/home/cvs/repository/maven-jahiawar-plugin/src/java/org/jahia/tomcat/jasper/JasperLaunch.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JasperLaunch.java 12 Oct 2004 17:40:56 -0000 1.2
+++ JasperLaunch.java 30 May 2005 14:20:08 -0000 1.3
@@ -17,6 +17,8 @@
import org.apache.commons.jelly.XMLOutput;
import org.apache.maven.project.Project;
import org.apache.maven.repository.Artifact;
+import java.util.Map;
+import java.lang.reflect.InvocationTargetException;
public class JasperLaunch extends TagSupport {
@@ -28,9 +30,12 @@
"maven.build.dest";
private static final String POM_PROPERTY =
"pom";
+ private static final String PLUGIN_PROPERTY = "plugin";
+
private static final String JAVA_HOME_PROPERTY = "java.home";
private Project pom = null;
+ private Project plugin = null;
private String tomcatLocation;
private String webXmlFragment = null;
private String packageName = null;
@@ -89,6 +94,9 @@
MethodUtils.invokeMethod(jasperInstance, "execute", null);
+ } catch (InvocationTargetException ite) {
+ ite.getTargetException().printStackTrace();
+ throw new JellyTagException(ite);
} catch (Exception exc) {
throw new JellyTagException(exc);
} finally {
@@ -121,10 +129,24 @@
pathURLs.addAll(getJARsInDir(tomcatCommonLibDir));
pom = (Project) context.getVariable(POM_PROPERTY);
+
+ // now we must add the Ant JAR to our class loader since Tomcat 5.5
+ // has a dependency to this JAR.
+ plugin = (Project) context.getVariable(PLUGIN_PROPERTY);
+ List plugArtifacts = plugin.getArtifacts();
+ Iterator plugArtifactIter = plugArtifacts.iterator();
+ while (plugArtifactIter.hasNext()) {
+ Artifact artifact = (Artifact) plugArtifactIter.next();
+ if (artifact.getDependency().getArtifactId().equals("ant")) {
+ pathURLs.add(artifact.getFile().toURL());
+ }
+ }
+
List artifacts = pom.getArtifacts();
Iterator artifactIter = artifacts.iterator();
while (artifactIter.hasNext()) {
Artifact artifact = (Artifact) artifactIter.next();
+ // System.out.println("Current artifact URL=" +
artifact.getFile().toURL());
pathURLs.add(artifact.getFile().toURL());
}