Re: Exclude dependency from scope runtime test classpath
Baptiste MATHUS wrote: > > Well, I guess you could do that by using, couldn't you? > Not that I can see. I need OpenJPA, Hibernate and EclipseLink classes at compile time no matter what profile(s) may happen to be active, but only, say, OpenJPA at test time. Can profiles do that? If so, how? Thanks, Laird -- View this message in context: http://www.nabble.com/Exclude-dependency-from-scope-runtime-test-classpath-tp23424431p23878578.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Exclude dependency from scope runtime test classpath
a...@#~$, sorry. I meant "by using profiles". This way you could add any dependency with any scope you like under different circumstances. 2009/6/4 Baptiste MATHUS > Well, I guess you could do that by using, couldn't you? > > Cheers > > 2009/6/4 ljnelson > > >> >> Baptiste MATHUS wrote: >> > >> > I guess you can file an enhancement request for this use, but I'm not >> sure >> > it would really make sense. Since you're likely to want to test this >> kind >> > of >> > dependency too in your tests. At least, IMO you'll have to provide a >> good >> > use case to justify this new feature. >> > >> >> Hello; I'd like to add to this issue by supplying a compile-time-only >> scope >> use case. >> >> When building JPA applications, often one wants to compile in support for >> all the various annotations from the persistence providers (Hibernate, >> EclipseLink and OpenJPA). I would like to make it so that all three of >> these libraries are available only at compile time, but only [i]one[/i] of >> them is available at test time. >> >> Currently I have them all specified as scope=provided, and while that >> works, >> I would really like to test my classes in the presence of only one of >> these >> libraries, not all three. To put it another way, I want to ensure that >> although I reference EclipseLink annotations in my project, I don't need >> EclipseLink on the runtime/test path. I have no way of doing this that I >> know of inside my Maven project. >> >> Thoughts? >> >> Thanks, >> Laird >> -- >> View this message in context: >> http://www.nabble.com/Exclude-dependency-from-scope-runtime-test-classpath-tp23424431p23875222.html >> Sent from the Maven - Users mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> >> > > > -- > Baptiste MATHUS - http://batmat.net > Sauvez un arbre, > Mangez un castor ! > -- Baptiste MATHUS - http://batmat.net Sauvez un arbre, Mangez un castor !
Re: Exclude dependency from scope runtime test classpath
Well, I guess you could do that by using, couldn't you? Cheers 2009/6/4 ljnelson > > > Baptiste MATHUS wrote: > > > > I guess you can file an enhancement request for this use, but I'm not > sure > > it would really make sense. Since you're likely to want to test this kind > > of > > dependency too in your tests. At least, IMO you'll have to provide a good > > use case to justify this new feature. > > > > Hello; I'd like to add to this issue by supplying a compile-time-only scope > use case. > > When building JPA applications, often one wants to compile in support for > all the various annotations from the persistence providers (Hibernate, > EclipseLink and OpenJPA). I would like to make it so that all three of > these libraries are available only at compile time, but only [i]one[/i] of > them is available at test time. > > Currently I have them all specified as scope=provided, and while that > works, > I would really like to test my classes in the presence of only one of these > libraries, not all three. To put it another way, I want to ensure that > although I reference EclipseLink annotations in my project, I don't need > EclipseLink on the runtime/test path. I have no way of doing this that I > know of inside my Maven project. > > Thoughts? > > Thanks, > Laird > -- > View this message in context: > http://www.nabble.com/Exclude-dependency-from-scope-runtime-test-classpath-tp23424431p23875222.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > -- Baptiste MATHUS - http://batmat.net Sauvez un arbre, Mangez un castor !
Re: Exclude dependency from scope runtime test classpath
Baptiste MATHUS wrote: > > I guess you can file an enhancement request for this use, but I'm not sure > it would really make sense. Since you're likely to want to test this kind > of > dependency too in your tests. At least, IMO you'll have to provide a good > use case to justify this new feature. > Hello; I'd like to add to this issue by supplying a compile-time-only scope use case. When building JPA applications, often one wants to compile in support for all the various annotations from the persistence providers (Hibernate, EclipseLink and OpenJPA). I would like to make it so that all three of these libraries are available only at compile time, but only [i]one[/i] of them is available at test time. Currently I have them all specified as scope=provided, and while that works, I would really like to test my classes in the presence of only one of these libraries, not all three. To put it another way, I want to ensure that although I reference EclipseLink annotations in my project, I don't need EclipseLink on the runtime/test path. I have no way of doing this that I know of inside my Maven project. Thoughts? Thanks, Laird -- View this message in context: http://www.nabble.com/Exclude-dependency-from-scope-runtime-test-classpath-tp23424431p23875222.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Exclude dependency from scope runtime test classpath
The jar file in question is a 3:de part jar that we can't and should not change. The application depends on the jar for a certain specific operation, but not for the building and testing of the module itself. Don't ask me why, not my idea :) We use the jar only to Acceptance test the application. The problem is that the jar (dependency) is loaded in a separate classloader when you are running the application and are using the specific operation. I use runtime scope for now and see if I can solve it some other way later. Thanks for all help. Keep up the good work on Maven. Henrik Cummings,Steven skrev: Can the tests be in a separate jar? If so they could include the original jar with the code to test but exclude dependencies as needed. Steven -Original Message- From: Henrik [mailto:hen...@team11.org] Sent: Thursday, May 07, 2009 6:04 AM To: users@maven.apache.org Subject: Exclude dependency from scope runtime test classpath Hi, I was wondering if there is a way to remove a dependency from the test classpath when using runtime I want to make sure that the jar file is only used when running the application and not when testing it. So it really comes down to, I want to have the dependency (jar file) but i don't want to add it to compile or test classpath. Thanks, Henrik - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org -- CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: Exclude dependency from scope runtime test classpath
Can the tests be in a separate jar? If so they could include the original jar with the code to test but exclude dependencies as needed. Steven -Original Message- From: Henrik [mailto:hen...@team11.org] Sent: Thursday, May 07, 2009 6:04 AM To: users@maven.apache.org Subject: Exclude dependency from scope runtime test classpath Hi, I was wondering if there is a way to remove a dependency from the test classpath when using runtime I want to make sure that the jar file is only used when running the application and not when testing it. So it really comes down to, I want to have the dependency (jar file) but i don't want to add it to compile or test classpath. Thanks, Henrik - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org -- CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Exclude dependency from scope runtime test classpath
As explained in the documentation, provided is "much like compile", and "[...] available on the compilation and test classpath. Cheers. 2009/5/7 Fabien Kruba > Hi. > > did you tried "provided" scope instead? > > Hi, >> >> I was wondering if there is a way to remove a dependency from the test >> classpath when using runtime >> I want to make sure that the jar file is only used when running the >> application and not when testing it. >> >> So it really comes down to, I want to have the dependency (jar file) but i >> don't want to add it to compile or test classpath. >> >> Thanks, >> >> Henrik >> >> - >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > -- Baptiste MATHUS - http://batmat.net Sauvez un arbre, Mangez un castor !
Re: Exclude dependency from scope runtime test classpath
I don't think it is. The only existing scopes are those listed here: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope I guess you can file an enhancement request for this use, but I'm not sure it would really make sense. Since you're likely to want to test this kind of dependency too in your tests. At least, IMO you'll have to provide a good use case to justify this new feature. Cheers. 2009/5/7 Henrik > Hi, > > I was wondering if there is a way to remove a dependency from the test > classpath when using runtime > I want to make sure that the jar file is only used when running the > application and not when testing it. > > So it really comes down to, I want to have the dependency (jar file) but i > don't want to add it to compile or test classpath. > > Thanks, > > Henrik > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > -- Baptiste MATHUS - http://batmat.net Sauvez un arbre, Mangez un castor !
Re: Exclude dependency from scope runtime test classpath
Hi. did you tried "provided" scope instead? Hi, I was wondering if there is a way to remove a dependency from the test classpath when using runtime I want to make sure that the jar file is only used when running the application and not when testing it. So it really comes down to, I want to have the dependency (jar file) but i don't want to add it to compile or test classpath. Thanks, Henrik - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Exclude dependency from scope runtime test classpath
Hi, I was wondering if there is a way to remove a dependency from the test classpath when using runtime I want to make sure that the jar file is only used when running the application and not when testing it. So it really comes down to, I want to have the dependency (jar file) but i don't want to add it to compile or test classpath. Thanks, Henrik - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Antwort: RE: own classes and test-classes at the end of test classpath running surefire-2.4
problem is still remaining in surefire-2.4.3, see my last posting. - torsten Jörg Schaible <[EMAIL PROTECTED]> 17.07.2008 11:47 Bitte antworten an "Maven Users List" An "Maven Users List" Kopie Thema RE: own classes and test-classes at the end of test classpath running surefire-2.4 [EMAIL PROTECTED] wrote: > Hi, > > if I´m running JUnit Tests with Surefire-2.4 I got the following Use latest surefire plugin. - Jörg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: own classes and test-classes at the end of test classpath running surefire-2.4
[EMAIL PROTECTED] wrote: > Hi, > > if I´m running JUnit Tests with Surefire-2.4 I got the following Use latest surefire plugin. - Jörg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Antwort: own classes and test-classes at the end of test classpath running surefire-2.4
SurefirePlugin#constructSurefireBooter changes the classpath by doing: ... getLog().debug( "Test Classpath :" ); // Check if we need to add configured classes/test classes directories here. // If they are configured, we should remove the default to avoid conflicts. if ( !project.getBuild().getOutputDirectory().equals( classesDirectory.getAbsolutePath() ) ) { classpathElements.remove( project .getBuild().getOutputDirectory() ); classpathElements.add( classesDirectory.getAbsolutePath() ); } if ( !project.getBuild().getTestOutputDirectory().equals( testClassesDirectory.getAbsolutePath() ) ) { classpathElements.remove( project .getBuild().getTestOutputDirectory() ); classpathElements.add( testClassesDirectory.getAbsolutePath() ); } ... project.getBuild().getOutputDirectory() is " S:\pdv_cms\GDCAMS\src\pip\gdcams-pip-itest/target/classes" classesDirectory.getAbsolutePath() is: " S:\pdv_cms\GDCAMS\src\pip\gdcams-pip-itest\target\classes" So i think here a 2 bugs: (1) files/directories shouldn´t be compared just as String.equals() (2) an Element of classpathElements shouldn´t be removed and added to the end of the list, it should be replaced. I´ll file a bug to that issue and temporary fix my ${project.basedir}/${target.dir}/classes to use \\ instead of / have fun, Torsten [EMAIL PROTECTED] 17.07.2008 10:43 Bitte antworten an "Maven Users List" An users@maven.apache.org Kopie Thema own classes and test-classes at the end of test classpath running surefire-2.4 Hi, if I´m running JUnit Tests with Surefire-2.4 I got the following classpath: [DEBUG] Adding managed dependencies for unknown:surefire-junit4 [DEBUG] org.apache.maven.surefire:surefire-api:jar:2.4 [DEBUG] org.apache.maven.surefire:surefire-booter:jar:2.4 [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.4.9 [DEBUG] org.apache.maven.surefire:surefire-junit4:jar:2.4:test (selected for test) [DEBUG] junit:junit:jar:4.0:test (selected for test) [DEBUG] org.apache.maven.surefire:surefire-api:jar:2.4:test (selected for test) [DEBUG] Adding to surefire test classpath: s:\mavenrepo\org\apache\maven\surefire\surefire-junit4\2.4\surefire-junit4-2.4.jar [DEBUG] Adding to surefire test classpath: s:\mavenrepo\junit\junit\4.0\junit-4.0.jar [DEBUG] Adding to surefire test classpath: s:\mavenrepo\org\apache\maven\surefire\surefire-api\2.4\surefire-api-2.4.jar [DEBUG] Test Classpath : [DEBUG] s:\mavenrepo\log4j\log4j\1.2.13\log4j-1.2.13.jar [DEBUG] s:\mavenrepo\javax\xml\ws\jaxws-api\2.1\jaxws-api-2.1.jar [DEBUG] s:\mavenrepo\javax\xml\bind\jaxb-api\2.1\jaxb-api-2.1.jar ... ... [DEBUG] s:\mavenrepo\org\objectstyle\ashwood\ashwood\1.1\ashwood-1.1.jar [DEBUG] s:\mavenrepo\com\gide\gdcams\pip\gdcams-pip-srv-common\2.7.1-SNAPSHOT\gdcams-pip-srv-common-2.7.1-SNAPSHOT-tests.jar [DEBUG] s:\mavenrepo\com\gide\gdcams\pip\gdcams-pip-server-ts\2.7.1-SNAPSHOT\gdcams-pip-server-ts-2.7.1-SNAPSHOT.jar [DEBUG] s:\mavenrepo\org\apache\xmlsec\1.4.1\xmlsec-1.4.1.jar [DEBUG] S:\pdv_cms\GDCAMS\src\pip\gdcams-pip-itest\target\classes [DEBUG] S:\pdv_cms\GDCAMS\src\pip\gdcams-pip-itest\target\test-classes As you can see, the classes and test-classes are at the end of the "test classpath", which now causes some problems. The only thing I changed was the following snippet, added to my own parent pom.xml: target
own classes and test-classes at the end of test classpath running surefire-2.4
Hi, if I´m running JUnit Tests with Surefire-2.4 I got the following classpath: [DEBUG] Adding managed dependencies for unknown:surefire-junit4 [DEBUG] org.apache.maven.surefire:surefire-api:jar:2.4 [DEBUG] org.apache.maven.surefire:surefire-booter:jar:2.4 [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.4.9 [DEBUG] org.apache.maven.surefire:surefire-junit4:jar:2.4:test (selected for test) [DEBUG] junit:junit:jar:4.0:test (selected for test) [DEBUG] org.apache.maven.surefire:surefire-api:jar:2.4:test (selected for test) [DEBUG] Adding to surefire test classpath: s:\mavenrepo\org\apache\maven\surefire\surefire-junit4\2.4\surefire-junit4-2.4.jar [DEBUG] Adding to surefire test classpath: s:\mavenrepo\junit\junit\4.0\junit-4.0.jar [DEBUG] Adding to surefire test classpath: s:\mavenrepo\org\apache\maven\surefire\surefire-api\2.4\surefire-api-2.4.jar [DEBUG] Test Classpath : [DEBUG] s:\mavenrepo\log4j\log4j\1.2.13\log4j-1.2.13.jar [DEBUG] s:\mavenrepo\javax\xml\ws\jaxws-api\2.1\jaxws-api-2.1.jar [DEBUG] s:\mavenrepo\javax\xml\bind\jaxb-api\2.1\jaxb-api-2.1.jar ... ... [DEBUG] s:\mavenrepo\org\objectstyle\ashwood\ashwood\1.1\ashwood-1.1.jar [DEBUG] s:\mavenrepo\com\gide\gdcams\pip\gdcams-pip-srv-common\2.7.1-SNAPSHOT\gdcams-pip-srv-common-2.7.1-SNAPSHOT-tests.jar [DEBUG] s:\mavenrepo\com\gide\gdcams\pip\gdcams-pip-server-ts\2.7.1-SNAPSHOT\gdcams-pip-server-ts-2.7.1-SNAPSHOT.jar [DEBUG] s:\mavenrepo\org\apache\xmlsec\1.4.1\xmlsec-1.4.1.jar [DEBUG] S:\pdv_cms\GDCAMS\src\pip\gdcams-pip-itest\target\classes [DEBUG] S:\pdv_cms\GDCAMS\src\pip\gdcams-pip-itest\target\test-classes As you can see, the classes and test-classes are at the end of the "test classpath", which now causes some problems. The only thing I changed was the following snippet, added to my own parent pom.xml: target
Re: Test classpath issue with v2.0.8 and v2.0.9
I disagree with you on accessing the resources my way, but that is for another post. Anyways, I was able to upgrade to maven 2.0.8 and surefire plugin 2.4.3 and things worked as expected. The only unfortunate thing is that now it won't work on maven 2.0.7, but oh well. Clifton wrote: > > I have a couple of observations... First off I see you're writing you unit > tests in Groovy! That's a good thing of course for far too many reasons. > It's also an important detail to pay attention to. There are a hole host > of other details to look at as well. Secondly it appears you are trying to > query for the resource folder using code. This is not a good thing or a > necessary thing to do. Maven will put all of your "test resources" under > the test-classes folder unless something else somewhere else tells it not > to. Another detail is that your code is asking the wrong question and may > have been mistakenly getting at the right answer all along. It asks the > location of it's execution folder not the location of the resource folder. > I can show you the correct hack to locating the resource folder involving > a marker file which you could run and arrive at a more accurate answer. > More on that later. Here's the important things to consider. Groovy is > interpreted/compiled. Running that same groovy code through a plugin (like > the Groovy plugin or Ant run) would place compiled classes in your classes > output folder. In one case I'm assuming the code was being copied from the > test/resources to the test-classes folder and in another case it is > possibly being filtered. I can't tell without looking. > > Here's some things to look for. Find out where the Groovy code is being > run from. Is it being both compiled to target/classes and copied over to > target/test-classes as .groovy files? If so then there's some ambiguity > worth cleaning up. What is it you are actually trying to do? Do you want > to run the scripts or do you want to compile them? If you are compiling > them make sure you point the compiler to the correct output folder. > > I feel like I'm babbling and confusing you more than helping but I'm sure > your problem lies in whther you compile to the correct output folder or > copy to the correct output folder. Look for filters that may have been > added as well. > > jlo_gestalt wrote: >> >> When trying to access test resources in my unit tests, maven 2.0.8 and >> above are returning the wrong directory. >> >> Here is my basic code to access the folder >> def file = new JmblXsltDriverTest().getClass().getResource("/")?.file >> println file >> >> On 2.0.7 this would print >> /workspace/checkout/weather/trunk/jetjwis/jbi/jmbl-xslt/target/test-classes/ >> >> On 2.0.8 and 2.0.9 this prints >> /workspace/checkout/weather/trunk/jetjwis/jbi/jmbl-xslt/target/classes/ >> >> To me this is a critical bug that would almost certainly cause every >> projects unit tests that access test resources to fail. >> >> >> > > -- View this message in context: http://www.nabble.com/Test-classpath-issue-with-v2.0.8-and-v2.0.9-tp17276386p17283178.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test classpath issue with v2.0.8 and v2.0.9
I have a couple of observations... First off I see you're writing you unit tests in Groovy! That's a good thing of course for far too many reasons. It's also an important detail to pay attention to. There are a hole host of other details to look at as well. Secondly it appears you are trying to query for the resource folder using code. This is not a good thing or a necessary thing to do. Maven will put all of your "test resources" under the test-classes folder unless something else somewhere else tells it not to. Another detail is that your code is asking the wrong question and may have been mistakenly getting at the right answer all along. It asks the location of it's execution folder not the location of the resource folder. I can show you the correct hack to locating the resource folder involving a marker file which you could run and arrive at a more accurate answer. More on that later. Here's the important things to consider. Groovy is interpreted/compiled. Running that same groovy code through a plugin (like the Groovy plugin or Ant run) would place compiled classes in your classes output folder. In one case I'm assuming the code was being copied from the test/resources to the test-classes folder and in another case it is possibly being filtered. I can't tell without looking. Here's some things to look for. Find out where the Groovy code is being run from. Is it being both compiled to target/classes and copied over to target/test-classes as .groovy files? If so then there's some ambiguity worth cleaning up. What is it you are actually trying to do? Do you want to run the scripts or do you want to compile them? If you are compiling them make sure you point the compiler to the correct output folder. I feel like I'm babbling and confusing you more than helping but I'm sure your problem lies in whther you compile to the correct output folder or copy to the correct output folder. Look for filters that may have been added as well. jlo_gestalt wrote: > > When trying to access test resources in my unit tests, maven 2.0.8 and > above are returning the wrong directory. > > Here is my basic code to access the folder > def file = new JmblXsltDriverTest().getClass().getResource("/")?.file > println file > > On 2.0.7 this would print > /workspace/checkout/weather/trunk/jetjwis/jbi/jmbl-xslt/target/test-classes/ > > On 2.0.8 and 2.0.9 this prints > /workspace/checkout/weather/trunk/jetjwis/jbi/jmbl-xslt/target/classes/ > > To me this is a critical bug that would almost certainly cause every > projects unit tests that access test resources to fail. > > > -- View this message in context: http://www.nabble.com/Test-classpath-issue-with-v2.0.8-and-v2.0.9-tp17276386p17281319.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test classpath issue with v2.0.8 and v2.0.9
jlo_gestalt wrote: When trying to access test resources in my unit tests, maven 2.0.8 and above are returning the wrong directory. Here is my basic code to access the folder def file = new JmblXsltDriverTest().getClass().getResource("/")?.file println file On 2.0.7 this would print /workspace/checkout/weather/trunk/jetjwis/jbi/jmbl-xslt/target/test-classes/ On 2.0.8 and 2.0.9 this prints /workspace/checkout/weather/trunk/jetjwis/jbi/jmbl-xslt/target/classes/ To me this is a critical bug that would almost certainly cause every projects unit tests that access test resources to fail. I'm going to guess you're encountering the bug described here: http://docs.codehaus.org/display/MAVENUSER/Classpath+Ordering+Bugs+in+Maven+Surefire Upgrading Surefire will probably restore you to the correct behavior. -Dan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Test classpath issue with v2.0.8 and v2.0.9
When trying to access test resources in my unit tests, maven 2.0.8 and above are returning the wrong directory. Here is my basic code to access the folder def file = new JmblXsltDriverTest().getClass().getResource("/")?.file println file On 2.0.7 this would print /workspace/checkout/weather/trunk/jetjwis/jbi/jmbl-xslt/target/test-classes/ On 2.0.8 and 2.0.9 this prints /workspace/checkout/weather/trunk/jetjwis/jbi/jmbl-xslt/target/classes/ To me this is a critical bug that would almost certainly cause every projects unit tests that access test resources to fail. -- View this message in context: http://www.nabble.com/Test-classpath-issue-with-v2.0.8-and-v2.0.9-tp17276386p17276386.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test classpath problem in multi module project
Hi Petr, I have a default.persistence.properties in the artifact with the EJB3 abstract test case. There I can specify whatever I like. Also, in the jboss in deploy/ejb3.deployer/META-INF there is another persistence.properties where I specify the production properties. Stefan Petr Nejedly wrote: Thanks Stefan, Very helpful. Just a question: You said you're using only one persistence.xml for both, testing and live deployment. How do you specify different Hibernate properties for those, eg dialect (Oracle vs HSQLDB), auto create schema (on vs off), etc? Cheers, Petr The information contained in this email and its attachments is confidential and may be the subject of legal, professional or other privileged information. It is intended only for the named addressees and may not be disclosed to anyone else without consent from On Demand. If you are not the named addressee you must not use, disclose, distribute, copy, print or rely on the contents of this email and should destroy it immediately. Whilst On Demand takes care to protect its systems from electronic virus attack or other harmful event, the firm gives no warranty that this email message (including any attachments to it) is free of any virus or other harmful matter and accepts no responsibility for any loss or damage resulting from the recipient receiving, opening or using it. If you need any further information, please contact the originator of this message on +44 (0)20 7131 6700. Website: www.ondemand.co.uk. Registered Office: 1 Stephen Street, London, W1T 1AL. Registered in the UK No.4094951. This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test classpath problem in multi module project
Thanks Stefan, Very helpful. Just a question: You said you're using only one persistence.xml for both, testing and live deployment. How do you specify different Hibernate properties for those, eg dialect (Oracle vs HSQLDB), auto create schema (on vs off), etc? Cheers, Petr The information contained in this email and its attachments is confidential and may be the subject of legal, professional or other privileged information. It is intended only for the named addressees and may not be disclosed to anyone else without consent from On Demand. If you are not the named addressee you must not use, disclose, distribute, copy, print or rely on the contents of this email and should destroy it immediately. Whilst On Demand takes care to protect its systems from electronic virus attack or other harmful event, the firm gives no warranty that this email message (including any attachments to it) is free of any virus or other harmful matter and accepts no responsibility for any loss or damage resulting from the recipient receiving, opening or using it. If you need any further information, please contact the originator of this message on +44 (0)20 7131 6700. Website: www.ondemand.co.uk. Registered Office: 1 Stephen Street, London, W1T 1AL. Registered in the UK No.4094951. This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
Re: Test classpath problem in multi module project
Hi Petr, is seems to me that you're trying to work around maven mechanisms, which is usually not a good idea. In this case, although I haven't completely understood what you are trying to do, I can share some experience about EJB3 and Testing. I have one artifact P where the JBoss embedded container xml files are in P/src/test/resources: -- default.persistence.properties -- ejb3-interceptors-aop.xml -- embedded-jboss-beans.xml Of P I build a test-jar. P has dependencies to -- jboss-ejb3-all -- thirdparty-all -- hibernate-all JARs as system. The artifacts A...O contain EJB3 beans, with only a persistence.xml in A/src/main/resources/META-INF which is the production persistence.xml and usually only contains the jta-data-source. The artifacts also contain a test-scope dependency to the test-jar of P. There is no other persistence.xml in the projects. Then I changed embedded-jboss-beans.xml so that our own datasources are being created as HSQLDB instances. For testing EJB3 within their own build cycle, a trick is needed: in I declare that the normal tests should not be run in the "test" phase, but rather in the "integration-test" phase: maven-surefire-plugin true integration-test test ${maven.test.skip.exec} This has two advantages: Firstly, the built jar is available during the tests, secondly, the other dependencies are available as JAR files, not as directories. Then, I have created an Abstract Test Case in P/src/test/java/...: --- SNIP import java.io.File; import java.net.URISyntaxException; import junit.framework.TestCase; import org.jboss.ejb3.embedded.EJB3StandaloneBootstrap; public abstract class AbstractEJB3TestCase extends TestCase { public AbstractEJB3TestCase() { super(); } public AbstractEJB3TestCase(String _name) { super(_name); } public void addEJB3BeanJar(Class _class) { appendPathToClasspath(_class.getResource( "/" + _class.getCanonicalName().replace(".", "/") + ".class").toString().replaceAll( "-client.jar!", ".jar!").replaceFirst("jar:file:([^!]+).*", "$1")); } @Override protected void setUp() throws Exception { System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory"); System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); addBuildJarToClasspath(); EJB3StandaloneBootstrap.boot(null); EJB3StandaloneBootstrap.scanClasspath(); } protected void addBuildJarToClasspath() throws URISyntaxException { final File targetDir = new File(this.getClass().getResource("/").toURI()).getParentFile(); File myJar = null; for (File f : targetDir.listFiles()) { final String name = f.getName(); if (name.endsWith(".jar") && !name.contains("-test") && !name.contains("-client")) { myJar = f; break; } } if (myJar != null) { appendPathToClasspath(myJar.getAbsolutePath()); } else { System.err.println("WARNING: JAR could not be found in the classpath."); System.err.println("Make sure that surefire runs in phase " + "\u00bbintegration-test\u00ab, not in the default phase \u00bbtest\u00ab."); } } protected void appendPathToClasspath(final String _ap) { final String oldCP = System.getProperty("java.class.path"); if (oldCP.contains(_ap) || !_ap.endsWith(".jar")) { return; } System.setProperty("java.class.path", oldCP + File.pathSeparatorChar + _ap); } @Override protected void tearDown() throws Exception { EJB3StandaloneBootstrap.shutdown(); } } --- SNIP This will do several things: Firstly, it searches for the jar that has just been built by accessing "/" through the classloader, secondly, it will modify java.class.path in order that the JBoss embedded deployer will find the JARs and deploy them, thirdly, it allows you to specify any EJB3 bean class in addEJB3BeanJar and will search for the appropriate JAR file in the classpath and will add it to java.class.path. The in the EJB3 modules, your test cases just need to extend the abstract test case, and your EJB3 beans will be deployed just like in production environment, but to a local in-memory HSQLDB. You can insert test data after the deploy using dbUnit. You can test your beans without any mock objects and just as if you had a JBoss running. Hope that this was not too long, Stefan Petr Nejedly wrote: Hi guys, I'm trying to solve this issue for a few days and haven't been able to crack it so far.
Test classpath problem in multi module project
Hi guys, I'm trying to solve this issue for a few days and haven't been able to crack it so far. The scenario is following: I have a parent project that includes sub-modules, each having their own pom.xml. Each of these modules produces an ejb3 package. I want to be able to run unit/integration tests using the JBoss embedded container on those modules from the parent project (so that it builds all modules). The resources are different for the test phase from the ones to be deployed (obviously). Normally it could all be achieved using src/main/resources and src/test/tesources but in this case SureFire can see all the resource files on its classpath and tries to use them (eg persistence.xml -> tries to deploy test AND live persistence units which fails the tests). I kind of hacked it so that I'm able to run tests in one module and package it. I end up with the following structure: A --target classes --META-INF (incl resources for tests, dependent modules can use these, when deploying this module's EJBs in the embedded JBoss for example) test-classes --A.jar (includes META-INF with resources for deployment) When I run the build from the parent project though, it builds the first one properly (eg A.jar) and when testing project B (which depends on A) it can see on its classpath A/target/classes + A/target/test-classes (this includes the proper resources for passing the tests) AND the built A.jar (deployment - ready, including resources that fail the tests). Dependency in B pom.xml is: foo A ejb provided Is there a way how to exclude built A.jar from classpath when two modules are dependent? Hope this makes sense, Petr The information contained in this email and its attachments is confidential and may be the subject of legal, professional or other privileged information. It is intended only for the named addressees and may not be disclosed to anyone else without consent from On Demand. If you are not the named addressee you must not use, disclose, distribute, copy, print or rely on the contents of this email and should destroy it immediately. Whilst On Demand takes care to protect its systems from electronic virus attack or other harmful event, the firm gives no warranty that this email message (including any attachments to it) is free of any virus or other harmful matter and accepts no responsibility for any loss or damage resulting from the recipient receiving, opening or using it. If you need any further information, please contact the originator of this message on +44 (0)20 7131 6700. Website: www.ondemand.co.uk. Registered Office: 1 Stephen Street, London, W1T 1AL. Registered in the UK No.4094951. This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
Test classpath
Under Maven v2.0.6, with Surefire plugin v2.3, the directory containing the .class files generated by the test-compile phase (${basedir}/target/test-classes/) is not included in java.class.path when I run "mvn test". (I got this info from the target/surefire-reports/TEST-.xml file for a failing test class.) This is a problem for me because one of my tests expects to be able to find the test .class files in the classpath, but can't under Maven 2, and so is failing. Under both Maven 1.1-beta-3 and IntelliJ IDEA, the generated test class files directory is included in java.class.path, so my test is succeeding. Is there anything I can do to change this? Explicitly including target/test-classes in the surefire plugin's configuration seems to have no effect. Thanks, Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to add jar to test classpath in a plugin ?
With sthe system scope it is possible to specify a jar in the dependencies. I try to write a plugin that adds all the jars contains in a directory to the test classpath. (I can not add jars in the pom dependencies because those jars are installed by another plugin). How can I add dependencies to MavenProject in a plugin ? -- View this message in context: http://www.nabble.com/How-to-add-jar-to-test-classpath-in-a-plugin---tf3329228s177.html#a9257071 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test Classpath Order Problems
On 27/11/06, rking999 <[EMAIL PROTECTED]> wrote: Thank you for the reply. I tried changing the scope to provided for the resin jar, but it still seems to be used in the test classpath. What would be nice is if I could actually remove it completelt from the test classpath - is there a way to do this with Maven? As you've found, classpath ordering can be a problem when searching for named resources such as service configuration files. You may be interested in the following issue I raised when having similar problems with log4j.properties: http://http://jira.codehaus.org/browse/MNG-1412jira.codehaus.org/browse/MNG-1412 Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test Classpath Order Problems
Hi, Thank you for the reply. I tried changing the scope to provided for the resin jar, but it still seems to be used in the test classpath. What would be nice is if I could actually remove it completelt from the test classpath - is there a way to do this with Maven? thanks -- View this message in context: http://www.nabble.com/Test-Classpath-Order-Problems-tf2699502s177.html#a7558741 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test Classpath Order Problems
Good day to you, rking999, You may want to try and set your xmlParserAPIs dependency to "test", while the dependency from resin to "compile" or "provided". Cheers, Franz [1] http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html rking999 wrote: > > Hi, > > The module that I am compiling has a dependancy on resin-x.x.jar which it > needs in order to compile the java source. When running unit tests, > however, it is accessing the DoucmentBuilderFactory in the resin jar > instead of the one in the xmlParserAPIs jar. > > I cant exclude the resin jar as it is needed to compile the java source. > There doesnt seem to be a way to change the order of the test classpath to > move the xmlParserApis jar above the resin one > > Any help would be greatly appreciated. thanks in advance. > -- View this message in context: http://www.nabble.com/Test-Classpath-Order-Problems-tf2699502s177.html#a7555769 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Test Classpath Order Problems
Hi, The module that I am compiling has a dependancy on resin-x.x.jar which it needs in order to compile the java source. When running unit tests, however, it is accessing the DoucmentBuilderFactory in the resin jar instead of the one in the xmlParserAPIs jar. I cant exclude the resin jar as it is needed to compile the java source. There doesnt seem to be a way to change the order of the test classpath to move the xmlParserApis jar above the resin one Any help would be greatly appreciated. thanks in advance. -- View this message in context: http://www.nabble.com/Test-Classpath-Order-Problems-tf2699502s177.html#a7527451 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2]How to get files into test classpath?
I have artifacts that I also build test jars from. The test jars is then referenced by other artifacts. The artifact (ansattportal-commons) that also should exist as test jar (tests and test resources): org.apache.maven.plugins maven-jar-plugin test-jar The artifact that depends is configured like this: no.avinor ansattportal-commons 1.0-SNAPSHOT no.avinor ansattportal-commons 1.0-SNAPSHOT test-jar test -Ronny Trygve Laugst?l-5 wrote: > > hamdard wrote: >> My problem is that I don't have the jar available in advance to add it to >> the >> maven's dependency section with scopt test. >> >> The jar is generated as part of a maven lifecycle prior to test >> ()generate-sources. I need the ability to add a a directory to the test >> classpath with a filter *.jar > > Make the plugin attach the generated (test) source directory to the > project and the compile plugin will compile the sources and include them > in the test class path automatically. > > -- > Trygve > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/-m2-How-to-get-files-into-test-classpath--tf987507.html#a6635942 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Maven1.1 is adding jars I don't want to my unit test classpath
I can't have a look at this now. Can you open an issue on Jira please ? http://jira.codehaus.org/browse/MPTEST thanks. Arnaud On 9/7/06, David G. Paschich <[EMAIL PROTECTED]> wrote: Quick summary: It appears that the Maven test module in Maven 1.1 beta 3 is adding, among other things, log4j and Xerces to my classpath before running unit tests. Can I get it to stop? I tried setting maven.test.excludeXmlApis to "yes" but that had no effect. Why do I want to do this? I do most of my development using Eclipse, and had an existing project which uses Maven 1.1 to build. I ran "maven eclipse", loaded it up, and then ran the unit tests, which failed with an error indicating that a class in Apache commons-logging was missing. But at the command line, the unit tests succeeded without error. After doing some digging, I added explicit dependencies on commons-logging and log4j to my project.xml, re-ran "maven eclipse", and now the tests run fine in Eclipse. Here's my concern. I didn't list these packages as dependencies in my project, but Maven added them to my classpath anyway when running unit tests. However, this code is going to get eventually deployed in an environment where those packages may or may not be present, in versions which may or may not be compatible with the ones Maven so helpfully added for me. So now I don't entirely trust my unit tests -- I would much rather have them fail if they need a jar not explicitly listed in the project dependencies to run. Can anyone help me out here? The only knobs I see in the test plugin documentation which seem relevant are maven.junit.fork and maven.test.excludeXmlApis -- I tried all 4 combinations of "yes" and "no" for those two values and still see the problem occuring. I'm using Java 1.4.2. Thanks, -- David G. Paschich [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Maven1.1 is adding jars I don't want to my unit test classpath
Quick summary: It appears that the Maven test module in Maven 1.1 beta 3 is adding, among other things, log4j and Xerces to my classpath before running unit tests. Can I get it to stop? I tried setting maven.test.excludeXmlApis to "yes" but that had no effect. Why do I want to do this? I do most of my development using Eclipse, and had an existing project which uses Maven 1.1 to build. I ran "maven eclipse", loaded it up, and then ran the unit tests, which failed with an error indicating that a class in Apache commons-logging was missing. But at the command line, the unit tests succeeded without error. After doing some digging, I added explicit dependencies on commons-logging and log4j to my project.xml, re-ran "maven eclipse", and now the tests run fine in Eclipse. Here's my concern. I didn't list these packages as dependencies in my project, but Maven added them to my classpath anyway when running unit tests. However, this code is going to get eventually deployed in an environment where those packages may or may not be present, in versions which may or may not be compatible with the ones Maven so helpfully added for me. So now I don't entirely trust my unit tests -- I would much rather have them fail if they need a jar not explicitly listed in the project dependencies to run. Can anyone help me out here? The only knobs I see in the test plugin documentation which seem relevant are maven.junit.fork and maven.test.excludeXmlApis -- I tried all 4 combinations of "yes" and "no" for those two values and still see the problem occuring. I'm using Java 1.4.2. Thanks, -- David G. Paschich [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Build/Test classpath order
On 19/07/06, Marc L. Veary <[EMAIL PROTECTED]> wrote: Hi All, In Eclipse the order in which libs are placed onto the classpath can be controlled. This is useful when you need to stub a particular class within a library: you can load the original and then load the stubbed class so that your stubbed class get called in place of the original (but leaving the rest of the classes in original lib available). Is there any way to do this with Maven 2? The order in which the dependencies are declared in the POM make no difference. Any thoughts? There's no way of doing this at the moment, but check this issue for a similar discussion: http://jira.codehaus.org/browse/MNG-1412 Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Build/Test classpath order
Hi All, In Eclipse the order in which libs are placed onto the classpath can be controlled. This is useful when you need to stub a particular class within a library: you can load the original and then load the stubbed class so that your stubbed class get called in place of the original (but leaving the rest of the classes in original lib available). Is there any way to do this with Maven 2? The order in which the dependencies are declared in the POM make no difference. Any thoughts? Kind regards, -- Viz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Build/Test classpath order
Hi All, In Eclipse the order in which libs placed onto the classpath. This is useful when you need to stub a particular class within a library: you can load the original and then load the stubbed class so that your stubbed class get called in place of the original (but leaving the rest of the original lib available). Is there any way to do this with Maven 2? The order in which the dependencies are declared in the POM make no difference. Any thoughts? Kind regards, -- Viz3 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2]How to get files into test classpath?
Thanks Trygve The workaround works! Here's my configuration that binds the generated sources and the test sources to the compiler plugin. This way maven compiles them and put the .classes to the executable (target) directory. . . org.apache.maven.plugins maven-compiler-plugin 1.5 1.5 dod/deployments/src/java/**/*.java src/test/java/**/*.java -- View this message in context: http://www.nabble.com/-m2-How+to+get+files+into+test+classpath--t987507.html#a4635367 Sent from the Maven - Users forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2]How to get files into test classpath?
hamdard wrote: My problem is that I don't have the jar available in advance to add it to the maven's dependency section with scopt test. The jar is generated as part of a maven lifecycle prior to test ()generate-sources. I need the ability to add a a directory to the test classpath with a filter *.jar Make the plugin attach the generated (test) source directory to the project and the compile plugin will compile the sources and include them in the test class path automatically. -- Trygve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2]How to get files into test classpath?
My problem is that I don't have the jar available in advance to add it to the maven's dependency section with scopt test. The jar is generated as part of a maven lifecycle prior to test ()generate-sources. I need the ability to add a a directory to the test classpath with a filter *.jar Is this possible? Thanks -- View this message in context: http://www.nabble.com/-m2-How+to+get+files+into+test+classpath--t987507.html#a4565660 Sent from the Maven - Users forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[m2]Surefire: classesDirectory not added to test classpath in forking
Hi, since surefire 2.2 in forking lifecycle isn't used. It appears not in the Test classpath. Is it a bug, or do I miss something? Best regards Andreas [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.2:test' --> [DEBUG] (f) basedir = c:\dev\webdev\karo\trunk\tools\proviso-m2-plugin [DEBUG] (f) childDelegation = true [DEBUG] (f) classesDirectory = c:\dev\webdev\karo\trunk\tools\proviso-m2-plugin\target\emma\data [DEBUG] (f) classpathElements = [c:\dev\webdev\karo\trunk\tools\proviso-m2-plugin\target\classes, c:\dev\webdev\karo\trunk\tools\proviso-m2-plugin\target\test-classes, c:\dev\.m2\repository\org\codehaus\plexus\plexus-utils\1.0.4\plexus-utils-1.0.4.jar, c:\dev\.m2\repository\junit\junit\3.8.1\junit-3.8.1.jar, c:\dev\.m2\repository\org\apache\maven\maven-model\2.0\maven-model-2.0.jar, c:\dev\.m2\repository\org\codehaus\plexus\plexus-container-default\1.0-alpha-8\plexus-container-default-1.0-alpha-8.jar, c:\dev\.m2\repository\org\apache\maven\maven-profile\2.0\maven-profile-2.0.jar, c:\dev\.m2\repository\oro\oro\2.0.7\oro-2.0.7.jar, c:\dev\.m2\repository\classworlds\classworlds\1.1-alpha-2\classworlds-1.1-alpha-2.jar, c:\dev\.m2\repository\doxia\doxia-core\1.0-alpha-4\doxia-core-1.0-alpha-4.jar, c:\dev\.m2\repository\qdox\qdox\1.5\qdox-1.5.jar, c:\dev\.m2\repository\org\apache\maven\maven-repository-metadata\2.0\maven-repository-metadata-2.0.jar, c:\dev\.m2\repository\org\testng\testng\4.7\testng-4.7-jdk15.jar, c:\dev\.m2\repository\commons-validator\commons-validator\1.1.4\commons-validator-1.1.4.jar, c:\dev\.m2\repository\org\apache\maven\maven-artifact-manager\2.0\maven-artifact-manager-2.0.jar, c:\dev\.m2\repository\org\apache\maven\wagon\wagon-provider-api\1.0-alpha-5\wagon-provider-api-1.0-alpha-5.jar, c:\dev\.m2\repository\org\apache\maven\maven-project\2.0\maven-project-2.0.jar, c:\dev\.m2\repository\org\apache\maven\reporting\maven-reporting-api\2.0\maven-reporting-api-2.0.jar, c:\dev\.m2\repository\org\apache\maven\maven-plugin-api\2.0\maven-plugin-api-2.0.jar, c:\dev\.m2\repository\org\apache\maven\maven-artifact\2.0\maven-artifact-2.0.jar, c:\dev\.m2\repository\doxia\doxia-sink-api\1.0-alpha-4\doxia-sink-api-1.0-alpha-4.jar, c:\dev\.m2\repository\org\apache\maven\reporting\maven-reporting-impl\2.0\maven-reporting-impl-2.0.jar, c:\dev\.m2\repository\bsh\bsh\2.0b1\bsh-2.0b1.jar] [DEBUG] (f) disableXmlReport = false [DEBUG] (f) forkMode = always [DEBUG] (f) jvm = java [DEBUG] (f) localRepository = [local] -> file://c:/dev/.m2/repository [DEBUG] (f) parallel = false [DEBUG] (f) pluginArtifactMap = {org.codehaus.plexus:plexus-utils=org.codehaus.plexus:plexus-utils:jar:1.1:runtime, org.apache.maven.surefire:surefire-api=org.apache.maven.surefire:surefire-api:jar:2.0:runtime, org.apache.maven:maven-artifact=org.apache.maven:maven-artifact:jar:2.0:runtime, org.apache.maven:maven-plugin-api=org.apache.maven:maven-plugin-api:jar:2.0:runtime, org.apache.maven.surefire:surefire-booter=org.apache.maven.surefire:surefire-booter:jar:2.0:runtime} [DEBUG] (f) printSummary = true [DEBUG] (f) projectArtifactMap = {org.apache.maven:maven-profile=org.apache.maven:maven-profile:jar:2.0:compile, org.apache.maven:maven-model=org.apache.maven:maven-model:jar:2.0:compile, org.codehaus.plexus:plexus-container-default=org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-8:compile, classworlds:classworlds=classworlds:classworlds:jar:1.1-alpha-2:compile, org.apache.maven:maven-artifact-manager=org.apache.maven:maven-artifact-manager:jar:2.0:compile, doxia:doxia-sink-api=doxia:doxia-sink-api:jar:1.0-alpha-4:compile, org.apache.maven.reporting:maven-reporting-api=org.apache.maven.reporting:maven-reporting-api:jar:2.0:compile, oro:oro=oro:oro:jar:2.0.7:compile, org.apache.maven:maven-repository-metadata=org.apache.maven:maven-repository-metadata:jar:2.0:compile, org.apache.maven.wagon:wagon-provider-api=org.apache.maven.wagon:wagon-provider-api:jar:1.0-alpha-5:compile, qdox:qdox=qdox:qdox:jar:1.5:test, org.apache.maven.reporting:maven-reporting-impl=org.apache.maven.reporting:maven-reporting-impl:jar:2.0:compile, org.apache.maven:maven-project=org.apache.maven:maven-project:jar:2.0:compile, org.codehaus.plexus:plexus-utils=org.codehaus.plexus:plexus-utils:jar:1.0.4:compile, commons-validator:commons-validator=commons-validator:commons-validator:jar:1.1.4:compile, junit:junit=junit:junit:jar:3.8.1:compile, org.testng:testng=org.testng:testng:jar:jdk15:4.7:test, org.apache.maven:maven-artifact=org.apache.maven:maven-artifact:jar:2.0:compile, org.apache.maven:maven-plugin-api=org.apache.maven:maven-plugin-api:jar:2.0:compile, bsh:bsh=bsh:bsh:jar:2.0b1:test, doxia:doxia-core=doxia:doxia-core:jar:1.0-alpha-4:compile} [DEBUG] (f) remoteRepositories = [[Maven Snapshots] -> http://snapshots.maven.codehaus.org/maven2/, [Carifin plugins] -> http://fftlrd3401:8080/maven2/, [central] -> http://repo1.maven.org/maven2] [DEBUG] (f) rep
Re: [m2]How to get files into test classpath?
Can you define a series of dependencies that have test? That would be ideal, since it'll use Maven's artifact resolution code to retrieve and manage them for you. HTH, -john On 5/22/06, hamdard <[EMAIL PROTECTED]> wrote: Hi I have a similar issue where I want to add a jar to the test classpath, before running the tests. The jar is generated dynamically (at runtime), so I can't make a static declaration in the pom. I need to do something like: lib/ *.jar But it doesn't work when I try. Thanks -- View this message in context: http://www.nabble.com/-m2-How+to+get+files+into+test+classpath--t987507.html#a4512885 Sent from the Maven - Users forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2]How to get files into test classpath?
Hi I have a similar issue where I want to add a jar to the test classpath, before running the tests. The jar is generated dynamically (at runtime), so I can't make a static declaration in the pom. I need to do something like: lib/ *.jar But it doesn't work when I try. Thanks -- View this message in context: http://www.nabble.com/-m2-How+to+get+files+into+test+classpath--t987507.html#a4512885 Sent from the Maven - Users forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SV: [m2]How to get files into test classpath?
Kaare I have a similar issue where I want to add a jar to the test classpath, before running the tests. The jar is generated dynamically (at runtime), so I can't make a static declaration in the pom. I need to do something like: lib/ *.jar But it doesn't work when I try. -Sajjad Bengt-Erik Fröberg <[EMAIL PROTECTED]> 24/01/2006 15:01 Please respond to "Maven Users List" To: "'Maven Users List'" cc: Subject: SV: [m2]How to get files into test classpath? Lovely, thanks! /B-E -Ursprungligt meddelande- Från: Kaare Nilsen [mailto:[EMAIL PROTECTED] Skickat: den 24 januari 2006 15:56 Till: Maven Users List Ämne: Re: [m2]How to get files into test classpath? You could do like this in your pom: ... /accesscontro/srcl/WEB-INF *.xml ... But rememeber then you need to add your current test resources in there also.. like .e.g. ... /accesscontro/srcl/WEB-INF *.xml src/test/resources *.* ... /Kaare On 24/01/06, Bengt-Erik Fröberg <[EMAIL PROTECTED]> wrote: > Hi > > > > I want to add the path /accesscontro/srcl/WEB-INF/*.xml to the test > classpath. > > There I have a sping configuration file. > > How do I do it? > > > > Regards, > > > > /B-E > > > > > > == > > Bengt-Erik Fröberg, Databasadministratör > > Institutionen för Epidemiologi och Biostatistik (MEB) > > Karolinska Institutet > > Box 281 > > 171 77 Stockholm > > Tel: (08)-524 823 76 > > Internet: <http://www.meb.ki.se/> http://www.meb.ki.se/ > > > > > - 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 - configuring test classpath
I have an archetype with a dependency on a plugin to generate jar file(s) (generated in /lib) The unit tests within this archetype need to access the jar(s), so how can I configure the maven test classpath to include the jar(s) when I run 'mvn test' Thanks, John This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SV: [m2]How to get files into test classpath?
Lovely, thanks! /B-E -Ursprungligt meddelande- Från: Kaare Nilsen [mailto:[EMAIL PROTECTED] Skickat: den 24 januari 2006 15:56 Till: Maven Users List Ämne: Re: [m2]How to get files into test classpath? You could do like this in your pom: ... /accesscontro/srcl/WEB-INF *.xml ... But rememeber then you need to add your current test resources in there also.. like .e.g. ... /accesscontro/srcl/WEB-INF *.xml src/test/resources *.* ... /Kaare On 24/01/06, Bengt-Erik Fröberg <[EMAIL PROTECTED]> wrote: > Hi > > > > I want to add the path /accesscontro/srcl/WEB-INF/*.xml to the test > classpath. > > There I have a sping configuration file. > > How do I do it? > > > > Regards, > > > > /B-E > > > > > > == > > Bengt-Erik Fröberg, Databasadministratör > > Institutionen för Epidemiologi och Biostatistik (MEB) > > Karolinska Institutet > > Box 281 > > 171 77 Stockholm > > Tel: (08)-524 823 76 > > Internet: <http://www.meb.ki.se/> http://www.meb.ki.se/ > > > > > - 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]How to get files into test classpath?
You could do like this in your pom: ... /accesscontro/srcl/WEB-INF *.xml ... But rememeber then you need to add your current test resources in there also.. like .e.g. ... /accesscontro/srcl/WEB-INF *.xml src/test/resources *.* ... /Kaare On 24/01/06, Bengt-Erik Fröberg <[EMAIL PROTECTED]> wrote: > Hi > > > > I want to add the path /accesscontro/srcl/WEB-INF/*.xml to the test > classpath. > > There I have a sping configuration file. > > How do I do it? > > > > Regards, > > > > /B-E > > > > > > == > > Bengt-Erik Fröberg, Databasadministratör > > Institutionen för Epidemiologi och Biostatistik (MEB) > > Karolinska Institutet > > Box 281 > > 171 77 Stockholm > > Tel: (08)-524 823 76 > > Internet: <http://www.meb.ki.se/> http://www.meb.ki.se/ > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[m2]How to get files into test classpath?
Hi I want to add the path /accesscontro/srcl/WEB-INF/*.xml to the test classpath. There I have a sping configuration file. How do I do it? Regards, /B-E == Bengt-Erik Fröberg, Databasadministratör Institutionen för Epidemiologi och Biostatistik (MEB) Karolinska Institutet Box 281 171 77 Stockholm Tel: (08)-524 823 76 Internet: <http://www.meb.ki.se/> http://www.meb.ki.se/
unit test classpath issue / java.lang.LinkageError
Hello, I'm new to maven and Java 5 and I just started a project using Maven 2. So far everything has been great except for the following issue. I'm currently having a problem getting a particular unit test to run successfully. I'm using java 1.5.0_04 and was trying to validate some XML against a schema. I'm compiling the schema. My code looks like this: final SAXParserFactory spf = SAXParserFactory.newInstance(); System.out.println(spf.getClass().getName()); spf.setSchema(schema); final SAXParser saxParser = spf.newSAXParser(); saxParser.parse(new InputSource(new StringReader(xml)), new FailingHandler(xml)); I got this error: java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null" at javax.xml.parsers.SAXParserFactory.setSchema(SAXParserFactory.java:361) on the "spf.setSchema(schema);" line It seems to be because when maven runs the unit test, it picks up the SAXParserFactory "org.apache.xerces.jaxp.SAXParserFactoryImpl"; when run from eclipse it picks up "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl" which is coming from the Java5 libraries. Running maven with the -X option, I can see there are numerous Xerces libraries being put in the classpath, for example: [DEBUG] /home/tim/.m2/repository/xerces/xercesImpl/2.6.2/xercesImpl-2.6.2.jar [DEBUG] /home/tim/.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar [DEBUG] /home/tim/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar [DEBUG] /home/tim/.m2/repository/xerces/xerces/2.0.2/xerces-2.0.2.jar So I added once to the surefire plugin. However, this caused my unit tests to fail earlier with the following exception: java.lang.LinkageError: Class javax/xml/transform/Source violates loader constraints at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:489) Does anyone have any suggestions on how to resolve this issue? Is forking the unit test the correct thing to do? Do I need to add the Java5 libraries to the classpath ahead of the others? Update: So I found a workaround when is not set - by manually telling jaxp which parser factory to use: System.setProperty("javax.xml.parsers.SAXParserFactory", "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"); This seems like a bit of a kludge though - I don't like specifying internal Java classes. However, things still fail when I use the Cobertura plugin to do code coverage, since that seems to force a fork. So I guess I still need to figure out how to get my unit tests to run with once. Info: echo $JAVA_HOME /opt/apps/jdk1.5.0_04 java -version java version "1.5.0_04" mvn -version Maven version: 2.0.1 Any help would be greatly appreciated, Thanks, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding a jar to the unit test classpath
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mar 2, 2005, at 18:03, Mark D. Hansen wrote: I'm using XmlBeans to generated some Java/XML binding classes that get used in my junit tests. The way XmlBeans works, these classes end up in a jar named "xmltypes.jar". The trick, at least for me, is to unpack the jar into the target/ directory. Some caveats for what follows. My copy of XmlBeans was built from a CVS snapshot from 2004-01-22. Also, I realize that some of the directories could be defined more portably. This works for me, and I haven't had to change it since. Note that the XSchema source files are in ${basedir}/src/schemata. So, how do I get it on the junit testing classpath? I'd guess you would want to unjar to ${basedir}/target/test-classes. - -- Craig S. Cottingham [EMAIL PROTECTED] OpenPGP key available from: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7977F79C -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCJliXEJLQ3Hl395wRAq27AKCCq1V6eoUo3Fudb7xyRuKfdHwmxACgyhbk g+hqZRtHQUYuCZdse7UAP9U= =j/Pp -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
adding a jar to the unit test classpath
I'm using XmlBeans to generated some Java/XML binding classes that get used in my junit tests. The way XmlBeans works, these classes end up in a jar named "xmltypes.jar". I can list xmltypes.jar as a dependency because it doesn't exist at the time that I invoke "maven test". So, how do I get it on the junit testing classpath? I tried this: ${basedir}/target/work/lib xmltypes.jar But it doesn't work. Any ideas? Is there a "standard" way to deal with this issue in Maven? -- Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Unit test classpath
Is there any possibility to use jars in the unit test classpath that won't be repeated in the application classpath ? Reading the user guide indicates resources can be specific to unit tests, but what about jar dependencies ? Tanks in advance for any help. Loïc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cactus Test Classpath Problems
You are right, AFAIK, IUTest never went anywhere... Eric Pugh -Original Message- From: Sonnek, Ryan [mailto:[EMAIL PROTECTED] Sent: Monday, June 02, 2003 11:56 AM To: 'Maven Users List' Subject: RE: Cactus Test Classpath Problems I had the same question a couple days ago. It doesn't seem that the iutest is used by anything. Am I wrong? -Original Message- From: Mark McBride [mailto:[EMAIL PROTECTED] Sent: Monday, June 02, 2003 10:50 AM To: Maven Users List Subject: RE: Cactus Test Classpath Problems I thought the cactus test belonged in /src/iutest as stated in http://maven.apache.org/reference/dirlayout.html . If they don't belong there is the /src/iutest directory used for anything else? Thanks! -Mark At 05:09 PM 6/2/2003 +0200, you wrote: >err? > >Your cactus tests should be in /src/test-cactus (as explained >here: http://maven.apache.org/reference/plugins/cactus/properties.html). Mark T. McBride Computer Scientist Lawrence Livermore National Laboratory http://www.llnl.gov Office: (925) 423-1627 Fax: (925) 423-3140 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cactus Test Classpath Problems
I had the same question a couple days ago. It doesn't seem that the iutest is used by anything. Am I wrong? -Original Message- From: Mark McBride [mailto:[EMAIL PROTECTED] Sent: Monday, June 02, 2003 10:50 AM To: Maven Users List Subject: RE: Cactus Test Classpath Problems I thought the cactus test belonged in /src/iutest as stated in http://maven.apache.org/reference/dirlayout.html . If they don't belong there is the /src/iutest directory used for anything else? Thanks! -Mark At 05:09 PM 6/2/2003 +0200, you wrote: >err? > >Your cactus tests should be in /src/test-cactus (as explained >here: http://maven.apache.org/reference/plugins/cactus/properties.html). Mark T. McBride Computer Scientist Lawrence Livermore National Laboratory http://www.llnl.gov Office: (925) 423-1627 Fax: (925) 423-3140 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cactus Test Classpath Problems
I thought the cactus test belonged in /src/iutest as stated in http://maven.apache.org/reference/dirlayout.html . If they don't belong there is the /src/iutest directory used for anything else? Thanks! -Mark At 05:09 PM 6/2/2003 +0200, you wrote: err? Your cactus tests should be in /src/test-cactus (as explained here: http://maven.apache.org/reference/plugins/cactus/properties.html). Mark T. McBride Computer Scientist Lawrence Livermore National Laboratory http://www.llnl.gov Office: (925) 423-1627 Fax: (925) 423-3140
RE: Cactus Test Classpath Problems
> -Original Message- > From: brian janaszek [mailto:[EMAIL PROTECTED] > Sent: 02 June 2003 16:38 > To: [EMAIL PROTECTED] > Subject: Cactus Test Classpath Problems > > Hi > > I'm not sure if I'm simply missing something in the docs regarding > Cactus and the Maven unit testing goals, but I'm having an issue with > the classpath when Maven tries to compile my tests. > > My tests reside in the /WEB-INF/src/test directory generated by Maven, err? Your cactus tests should be in /src/test-cactus (as explained here: http://maven.apache.org/reference/plugins/cactus/properties.html). > and the tests import other classes from the application. When Maven > attempts to compile the test classes, it cannot find the previously > compiled application classes. If I run Maven in verbose mode, the > classpath used by the tests includes all of my dependencies, but none of > the application classes. Am I simply missing an option in my > project.xml to include those classes? The cactus plugins will use the following classpath: which means you get all the dependencies defined in your project.xml + the cactus related jars + the compiles classes that you have put in src/java -Vincent > > TIA > bmj > > > - > 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]
Cactus Test Classpath Problems
Hi I'm not sure if I'm simply missing something in the docs regarding Cactus and the Maven unit testing goals, but I'm having an issue with the classpath when Maven tries to compile my tests. My tests reside in the /WEB-INF/src/test directory generated by Maven, and the tests import other classes from the application. When Maven attempts to compile the test classes, it cannot find the previously compiled application classes. If I run Maven in verbose mode, the classpath used by the tests includes all of my dependencies, but none of the application classes. Am I simply missing an option in my project.xml to include those classes? TIA bmj - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]