BriteSnow / snow

A Lightweight, Google Guice, Simple, and Powerful Web Application Framework that makes building modern Web Application a breeze! Fully open source, Apache V2 licensed.
http://britesnow.com/snow
29 stars 10 forks source link

Minor changed: Fix "mvn test" and replace System.out.println with logger.info #31

Closed evanj closed 10 years ago

evanj commented 11 years ago

I'm a Maven newbie, so this may be the wrong fix, but it makes mvn test work on my machine. Ideally it should only add that dependency when compiling the test classes? I have no idea how to do that.

The System.out.println change is my anal retentive nature, wanting to control these messages with my standard logging config.

Feel free to reject; Thanks!

jeremychone commented 11 years ago

Sorry for the delay, let me look at this.

jeremychone commented 11 years ago

I am not sure why you need to add rt.jar as a compile dependency. I do the mvn clean package and it works fine for me. Can you tell me more about what fail when you do "mvn clean package"?

jeremychone commented 11 years ago

Also @evanj are you trying to compile Snow or your application. If you try to compile application, perhaps you can modify the application pom.xml bootclasspath. Would that work?

evanj commented 11 years ago

I was trying to compile the snow jar itself, in order to replace the embedded System.out.println calls with SLF4J calls (so I can turn them off). I get the following error when I checkout the current version and run "mvn package". (javac 1.7.0_21 on Mac OS X). Google searching shows that this internal package is in rt.jar.

[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ snow --- [INFO] Compiling 50 source files to /Users/ej/snow/target/test-classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[6,42] error: package sun.org.mozilla.javascript.internal does not exist [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[7,42] error: package sun.org.mozilla.javascript.internal does not exist [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[8,42] error: package sun.org.mozilla.javascript.internal does not exist [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[19,8] error: cannot find symbol [ERROR] class JsTest /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[19,21] error: cannot find symbol [ERROR] class JsTest /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[20,8] error: cannot find symbol [ERROR] class JsTest /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[21,28] error: cannot find symbol [ERROR] class JsTest /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[22,8] error: cannot find symbol [ERROR] class JsTest /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[25,8] error: cannot find symbol [INFO] 9 errors

evanj commented 11 years ago

Just to clarify: I am not super familiar with Maven or Snow, so I didn't see if the test could avoid the sun.org.mozilla.javascript.internal package and just use the public interface, I just did the classic "search to find the solution" :)

jeremychone commented 11 years ago

Ok, let me look into this. Printing these inputs in System.out was aggressive and I can see the point of moving them to logger.

About the pom.xml modification I am a little bit more reserved since it has a path to it, and this might break builds in different OSes. Snow uses Rhino for .less compilation, so, I have some unit test for those. Now, I do not understand what it works fine on my laptop (Mac) and not yours.

So, let me investigate what I do in JsTest, because, perhaps it is not needed anyway.

On Wed, Aug 14, 2013 at 1:30 PM, Evan Jones notifications@github.comwrote:

Just to clarify: I am not super familiar with Maven or Snow, so I didn't see if the test could avoid the sun.org.mozilla.javascript.internal package and just use the public interface, I just did the classic "search to find the solution" :)

— Reply to this email directly or view it on GitHubhttps://github.com/BriteSnow/snow/pull/31#issuecomment-22664827 .

Jeremy Chone http://britesnow.com/ (415) 699 9912 Building Enterprise HTML5 Applications

jeremychone commented 11 years ago

@evanj did you try Snow 2.0.2 or 2.0.3-SNAPSHOT ? I updated the Rhino version, so that might solve one of your problem.

evanj commented 11 years ago

I just pulled the latest github version and it still has the same error (package sun.org.mozilla.javascript.internal does not exist). My previous change to add ${java.home}/lib/rt.jar to pom.xml still works. Versions of stuff:

Yoho:snow ej$ mvn -version Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500) Maven home: /usr/share/maven Java version: 1.7.0_21, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"

Build error:

[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 6.668s [INFO] Finished at: Fri Oct 18 14:41:55 EDT 2013 [INFO] Final Memory: 20M/207M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (default-testCompile) on project snow: Compilation failure: Compilation failure: [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[6,42] error: package sun.org.mozilla.javascript.internal does not exist [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[7,42] error: package sun.org.mozilla.javascript.internal does not exist [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[8,42] error: package sun.org.mozilla.javascript.internal does not exist [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[19,8] error: cannot find symbol [ERROR] class JsTest [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[19,21] error: cannot find symbol [ERROR] class JsTest [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[20,8] error: cannot find symbol [ERROR] class JsTest [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[21,28] error: cannot find symbol [ERROR] class JsTest [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[22,8] error: cannot find symbol [ERROR] class JsTest [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[25,8] error: cannot find symbol [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

jeremychone commented 11 years ago

I am worry to put some local file in maven. I could not reproduce your issue. I will try to have my team building to see if they have the same issue as you.

Jeremy Chone http://britesnow.com On Oct 18, 2013 11:46 AM, "Evan Jones" notifications@github.com wrote:

I just pulled the latest github version and it still has the same error (package sun.org.mozilla.javascript.internal does not exist). My previous change to add ${java.home}/lib/rt.jar to pom.xml still works. Versions of stuff:

Yoho:snow ej$ mvn -version Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500) Maven home: /usr/share/maven Java version: 1.7.0_21, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"

Build error:

[INFO]

[INFO] BUILD FAILURE

[INFO]

[INFO] Total time: 6.668s [INFO] Finished at: Fri Oct 18 14:41:55 EDT 2013 [INFO] Final Memory: 20M/207M

[INFO]

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (default-testCompile) on project snow: Compilation failure: Compilation failure: [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[6,42] error: package sun.org.mozilla.javascript.internal does not exist [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[7,42] error: package sun.org.mozilla.javascript.internal does not exist [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[8,42] error: package sun.org.mozilla.javascript.internal does not exist [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[19,8] error: cannot find symbol [ERROR] class JsTest [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[19,21] error: cannot find symbol [ERROR] class JsTest [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[20,8] error: cannot find symbol [ERROR] class JsTest [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[21,28] error: cannot find symbol [ERROR] class JsTest [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[22,8] error: cannot find symbol [ERROR] class JsTest [ERROR] /Users/ej/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[25,8] error: cannot find symbol [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

— Reply to this email directly or view it on GitHubhttps://github.com/BriteSnow/snow/pull/31#issuecomment-26620063 .

evanj commented 11 years ago

At least rt.jar is part of the JDK. No idea what what may be different about my Java setup. These seem relevant. It seems as though adding rt.jar as a dependency is the only way to get access to these internal classes, at least on Mac OS X / Java 7?

https://groups.google.com/forum/?fromgroups=#!topic/plovr/zgMnG1WG_D0

http://www.innovationontherun.com/compilation-struggles-with-java-6-scriptengine-javascript-and-maven/

jeremychone commented 11 years ago

Ha, I still use the java 1.6 on Mac, so this might be it. I will ask my team to use 1.7 and we will see. I think this is more of a java setup than maven issue.

Jeremy Chone http://britesnow.com On Oct 18, 2013 12:29 PM, "Evan Jones" notifications@github.com wrote:

At least rt.jar is part of the JDK. No idea what what may be different about my Java setup. These seem relevant. It seems as though adding rt.jar as a dependency is the only way to get access to these internal classes, at least on Mac OS X / Java 7?

https://groups.google.com/forum/?fromgroups=#!topic/plovr/zgMnG1WG_D0

http://www.innovationontherun.com/compilation-struggles-with-java-6-scriptengine-javascript-and-maven/

— Reply to this email directly or view it on GitHubhttps://github.com/BriteSnow/snow/pull/31#issuecomment-26623127 .

south55 commented 11 years ago

hi all I have this error too [ERROR] 类 JsTest [ERROR] /Users/south/WORK/workspace_snow/SnowCore/snow/src/test/java/com/britesnow/snow/test/apptest/JsTest.java:[21,28]

I think this cause by JDK8 , because when I change to JDK6 or JDK7, it is OK. JDK8 does not have this package "sun.org.mozilla.javascript.internal"

Install this plugin http://www.eclipse.org/m2e/ and we can work in Eclipse and easy to change any JDK that we want. qq20131023-3 2x

qq20131023-4 2x

imranzahid01 commented 10 years ago

Jeremy: I have JDK7 on my mac, and have the same exact error (on the latest snapshot). On Windows JDK7 this is not a problem though.

jeremychone commented 10 years ago

Strange, I updated to JDK1.7 on mac, and everything work fine.

On Mon, Jan 13, 2014 at 7:46 AM, Imran Zahid notifications@github.comwrote:

Jeremy: I have JDK7 on my mac, and have the same exact error (on the latest snapshot). On Windows JDK7 this is not a problem though.

— Reply to this email directly or view it on GitHubhttps://github.com/BriteSnow/snow/pull/31#issuecomment-32180666 .

Jeremy Chone http://britesnow.com/ (415) 699 9912 Building Enterprise HTML5 Applications

imranzahid01 commented 10 years ago

Can you make sure maven is using jdk1.7 and not 1.6? mvn --version can easily let you know.

I cloned a clean copy of snow, and when I package it it gives me the error stated above. This is not the case on windows machine though.

jeremychone commented 10 years ago

Ha, you are right. I get 1.6 for maven even if I have 1.7 installed. I need to look how to change that and then, I will test again.

On Mon, Jan 13, 2014 at 9:58 AM, Imran Zahid notifications@github.comwrote:

Can you make sure maven is using jdk1.7 and not 1.6? mvn --version can easily let you know.

I cloned a clean copy of snow, and when I package it it gives me the error stated above. This is not the case on windows machine though.

— Reply to this email directly or view it on GitHubhttps://github.com/BriteSnow/snow/pull/31#issuecomment-32193593 .

Jeremy Chone http://britesnow.com/ (415) 699 9912 Building Enterprise HTML5 Applications

jeremychone commented 10 years ago

Ok, I finally updated to 1.7 on Maven on Mac and I do see the error. I am going accept this pull request. Sorry for the delay, but I needed to reproduce it before accepting it and I got swamped.

Hope you still have fun with Snow.