incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r581593 - /incubator/sling/trunk/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
Date Wed, 03 Oct 2007 13:22:24 GMT
Author: fmeschbe
Date: Wed Oct  3 06:22:24 2007
New Revision: 581593

URL: http://svn.apache.org/viewvc?rev=581593&view=rev
Log:
SLING-29 JspC plugin cannot create Compiler because JCL setup fails

Modified:
    incubator/sling/trunk/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java

Modified: incubator/sling/trunk/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java?rev=581593&r1=581592&r2=581593&view=diff
==============================================================================
--- incubator/sling/trunk/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
(original)
+++ incubator/sling/trunk/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
Wed Oct  3 06:22:24 2007
@@ -39,6 +39,8 @@
 
 import javax.servlet.ServletContext;
 
+import org.apache.commons.logging.impl.LogFactoryImpl;
+import org.apache.commons.logging.impl.SimpleLog;
 import org.apache.jasper.JasperException;
 import org.apache.jasper.JspCompilationContext;
 import org.apache.jasper.Options;
@@ -60,7 +62,7 @@
  * <code>jspc</code> compiling JSP into the target and creating a component
  * descriptor for Declarative Services to use the JSP with the help of the
  * appropriate adapter as component.
- *  
+ *
  * @goal jspc
  * @phase compile
  * @description Compile JSP Files into Servlet Classes using the same JSP
@@ -211,11 +213,22 @@
         // scanFiles(new File(sourceDirectory));
 
         // have the files compiled
+        String oldValue = System.getProperty(LogFactoryImpl.LOG_PROPERTY);
         try {
+            // ensure the JSP Compiler does not try to use Log4J
+            System.setProperty(LogFactoryImpl.LOG_PROPERTY,
+                SimpleLog.class.getName());
+
             executeInternal();
         } catch (JasperException je) {
             getLog().error("Compilation Failure", je);
             throw new MojoExecutionException(je.getMessage(), je);
+        } finally {
+            if (oldValue == null) {
+                System.clearProperty(LogFactoryImpl.LOG_PROPERTY);
+            } else {
+                System.setProperty(LogFactoryImpl.LOG_PROPERTY, oldValue);
+            }
         }
 
         project.addCompileSourceRoot(outputDirectory);



Mime
View raw message