Re: [m2][maven-surefire-plugin] using ClassLoader.getSystemResourceAsStream
Below you find the actual code I use. In order to get the error, you just need a JUnit testCase that constructs the PropertyReader class. Note that I can not change the line ClassLoader.getSystemResourceAsStream(" log.properties"); as it's part of a library we use. The file log.properties is present in the directory src/test/resources. package test.surefire; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class PropertyReader { private Properties systemLogProps; public PropertyReader() throws IOException { this.systemLogProps = new Properties(); InputStream is = ClassLoader.getSystemResourceAsStream(" log.properties"); // the following works // InputStream is = this.getClass ().getClassLoader().getResourceAsStream("log.properties"); if (is == null) { throw new RuntimeException("log.properties not found on the classpath"); } this.systemLogProps.load(is); } public String getProperty(String key) { return this.systemLogProps.getProperty(key); } } So the problem is that the file log.properties can not be found on the system classpath. Any help is appreciated. On 7/1/07, Andrew Williams <[EMAIL PROTECTED]> wrote: Perhaps posting the actual code will help. When it comes to classloading many loaders such as eclipse are very liberal whereas the surefire loader is more strict to the java spec. Andy On 27 Jun 2007, at 14:05, Erik Ruisma wrote: > Hello, > > I've been trying out several options on the maven-surefire-plugin > (useSystemClassLoader, forkMode, childDelegation), but without any > succes. > > We have some library that does a > ClassLoader.getSystemResourceAsStream in > order to read a property file. > I've added that property file under src/test/resources but 'Maven' > is unable > to find it (seems to have to do with the IsolatedClassLoader). > I can not change the getSystemResourceAsStream, as mentioned > several times > in this forum into something like this.getClass > ().getClassLoader().getResourceAsStream(... > > I'm not quite sure what useSystemClassLoader is meant to do > exactly. If I > try to use it I get the following error: > > [INFO] Building jar: C:\DOCUME~1\mfr\LOCALS~1\Temp > \surefirebooter58425.jar > Forking command line: C:\javadev\tools\java\sdk\1.4.2_04\jre\bin > \java -jar > C:\DOCUME~1\mfr\LOCALS~1\Temp\surefirebooter58425.jar > C:\DOCUME~1\mfr\LOCALS~1\Temp\surefire58423tmp > C:\DOCUME~1\mfr\LOCALS~1\Temp\surefire58424tmp > java.lang.NoClassDefFoundError: org/apache/maven/surefire/booter/ > SurefireBooter > Exception in thread "main" > > > Any clue on how to solve this error, or on how to get the > getSystemResourceAsStream method working with Maven ? > > > Thanks in advance ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2][maven-surefire-plugin] using ClassLoader.getSystemResourceAsStream
Perhaps posting the actual code will help. When it comes to classloading many loaders such as eclipse are very liberal whereas the surefire loader is more strict to the java spec. Andy On 27 Jun 2007, at 14:05, Erik Ruisma wrote: Hello, I've been trying out several options on the maven-surefire-plugin (useSystemClassLoader, forkMode, childDelegation), but without any succes. We have some library that does a ClassLoader.getSystemResourceAsStream in order to read a property file. I've added that property file under src/test/resources but 'Maven' is unable to find it (seems to have to do with the IsolatedClassLoader). I can not change the getSystemResourceAsStream, as mentioned several times in this forum into something like this.getClass ().getClassLoader().getResourceAsStream(... I'm not quite sure what useSystemClassLoader is meant to do exactly. If I try to use it I get the following error: [INFO] Building jar: C:\DOCUME~1\mfr\LOCALS~1\Temp \surefirebooter58425.jar Forking command line: C:\javadev\tools\java\sdk\1.4.2_04\jre\bin \java -jar C:\DOCUME~1\mfr\LOCALS~1\Temp\surefirebooter58425.jar C:\DOCUME~1\mfr\LOCALS~1\Temp\surefire58423tmp C:\DOCUME~1\mfr\LOCALS~1\Temp\surefire58424tmp java.lang.NoClassDefFoundError: org/apache/maven/surefire/booter/ SurefireBooter Exception in thread "main" Any clue on how to solve this error, or on how to get the getSystemResourceAsStream method working with Maven ? Thanks in advance ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[m2][maven-surefire-plugin] using ClassLoader.getSystemResourceAsStream
Hello, I've been trying out several options on the maven-surefire-plugin (useSystemClassLoader, forkMode, childDelegation), but without any succes. We have some library that does a ClassLoader.getSystemResourceAsStream in order to read a property file. I've added that property file under src/test/resources but 'Maven' is unable to find it (seems to have to do with the IsolatedClassLoader). I can not change the getSystemResourceAsStream, as mentioned several times in this forum into something like this.getClass ().getClassLoader().getResourceAsStream(... I'm not quite sure what useSystemClassLoader is meant to do exactly. If I try to use it I get the following error: [INFO] Building jar: C:\DOCUME~1\mfr\LOCALS~1\Temp\surefirebooter58425.jar Forking command line: C:\javadev\tools\java\sdk\1.4.2_04\jre\bin\java -jar C:\DOCUME~1\mfr\LOCALS~1\Temp\surefirebooter58425.jar C:\DOCUME~1\mfr\LOCALS~1\Temp\surefire58423tmp C:\DOCUME~1\mfr\LOCALS~1\Temp\surefire58424tmp java.lang.NoClassDefFoundError: org/apache/maven/surefire/booter/ SurefireBooter Exception in thread "main" Any clue on how to solve this error, or on how to get the getSystemResourceAsStream method working with Maven ? Thanks in advance !
RE: [m2] maven-surefire-plugin 2.1.3 vs 2.2 [solved]
I just figured out my test cases were failing because the geotools map transformation used by them does not work when assertions are enabled. Since maven-surefire-plugin enables them by default, I had to add the following configuration to the plugin. ... org.apache.maven.plugins maven-surefire-plugin 2.2 -disableassertions:org.geotools... ... Hope someone find this info useful. Dário -Original Message- From: Dário Luís Coneglian Oliveros Sent: quinta-feira, 18 de janeiro de 2007 09:35 To: Maven Users List Subject: RE: [m2] maven-surefire-plugin 2.1.3 vs 2.2 I noticed maven-surefire-plugin 2.1.3 uses forkMode='none' and childDelegation='true' as default. However If I add the same configuration to maven-surefire-plugin 2.2, my tests don't work. Since I use javolution.jar as a test dependency and it overrides some classes from java.lang.reflect, I get a 'prohibited package name' error. The same problem does not happen to 2.1.3. Any thoughts ? Any idea where to look at ? Dário -Original Message- From: Dário Luís Coneglian Oliveros Sent: quarta-feira, 17 de janeiro de 2007 16:13 To: Maven Users List (E-mail) Subject: [m2] maven-surefire-plugin 2.1.3 vs 2.2 I have some test cases that used to work with maven-surefire-plugin 2.1.3, but not with 2.2. Does anybody know what kind of configuration should be in 2.2 to get the same behaviour as of 2.1.3 ? I've tried a couple of them (forkMode=never, childDelegation=true), but could not get anything working. Any help is appreciated. Dário - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [m2] maven-surefire-plugin 2.1.3 vs 2.2
I noticed maven-surefire-plugin 2.1.3 uses forkMode='none' and childDelegation='true' as default. However If I add the same configuration to maven-surefire-plugin 2.2, my tests don't work. Since I use javolution.jar as a test dependency and it overrides some classes from java.lang.reflect, I get a 'prohibited package name' error. The same problem does not happen to 2.1.3. Any thoughts ? Any idea where to look at ? Dário -Original Message- From: Dário Luís Coneglian Oliveros Sent: quarta-feira, 17 de janeiro de 2007 16:13 To: Maven Users List (E-mail) Subject: [m2] maven-surefire-plugin 2.1.3 vs 2.2 I have some test cases that used to work with maven-surefire-plugin 2.1.3, but not with 2.2. Does anybody know what kind of configuration should be in 2.2 to get the same behaviour as of 2.1.3 ? I've tried a couple of them (forkMode=never, childDelegation=true), but could not get anything working. Any help is appreciated. Dário - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[m2] maven-surefire-plugin 2.1.3 vs 2.2
I have some test cases that used to work with maven-surefire-plugin 2.1.3, but not with 2.2. Does anybody know what kind of configuration should be in 2.2 to get the same behaviour as of 2.1.3 ? I've tried a couple of them (forkMode=never, childDelegation=true), but could not get anything working. Any help is appreciated. Dário - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2] maven surefire plugin
On Tue, Aug 09, 2005 at 07:10:54PM +0200, Ralph Pöllath wrote: > On 04.07.2005, at 04:29, Nadeem Bitar wrote: > >Where can I find documentation for the maven-surefire-plugin. I am > >looking on using testng instead of junit to run my tests. > > TestNG 2.5 has been released and comes with a maven plugin: > http://testng.org/doc/maven.html Not for Maven 2 which was the Maven version in question. Writing a plug-in for it should be pretty trivial though, hopefully they will write one themselfs. -- Trygve signature.asc Description: Digital signature
Re: [m2] maven surefire plugin
On 04.07.2005, at 04:29, Nadeem Bitar wrote: Where can I find documentation for the maven-surefire-plugin. I am looking on using testng instead of junit to run my tests. TestNG 2.5 has been released and comes with a maven plugin: http://testng.org/doc/maven.html Cheers, -Ralph. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2] maven surefire plugin
On Sun, 2005-07-03 at 23:59 -0400, Jason van Zyl wrote: > On Sun, 2005-07-03 at 19:29 -0700, Nadeem Bitar wrote: > > Where can I find documentation for the maven-surefire-plugin. I am > > looking on using testng instead of junit to run my tests. > > There is just the source for the surefire plugin here: > > http://svn.apache.org/viewcvs.cgi/maven/components/trunk/maven- > plugins/maven-surefire-plugin/ > > And the surefire code itself is here: > > http://cvs.surefire.codehaus.org/surefire/ > > But it would also be great if you wanted to develop a TestNG m2 plugin > as I'm sure lots of people would be interested in using it. It would be nice to have at least some javadoc to write a plugin. I browsed the source and there was almost zero javadoc. Out of curiosity why is it called surefire? Also what's a Battery? > > > thanks > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2] maven surefire plugin
On Sun, 2005-07-03 at 19:29 -0700, Nadeem Bitar wrote: > Where can I find documentation for the maven-surefire-plugin. I am > looking on using testng instead of junit to run my tests. There is just the source for the surefire plugin here: http://svn.apache.org/viewcvs.cgi/maven/components/trunk/maven- plugins/maven-surefire-plugin/ And the surefire code itself is here: http://cvs.surefire.codehaus.org/surefire/ But it would also be great if you wanted to develop a TestNG m2 plugin as I'm sure lots of people would be interested in using it. > thanks > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- jvz. Jason van Zyl jason at maven.org http://maven.apache.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[m2] maven surefire plugin
Where can I find documentation for the maven-surefire-plugin. I am looking on using testng instead of junit to run my tests. thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]