RE: Surefire and testSourceDirectory
This is simply not where testSourceDirectory goes in the pom. The Surefire plugin does not look for this value where you've put it, therefore it has no effect on your build which is correct. [Marcin Kwapisz] Why? This is parameter for surefire with default value set to ${project.build.testSourceDirectory}. The documentation for the surefire plugin is very misleading, and I think testSourceDirectory should be removed from required parameters (if it is ignored). I can set other parameters like classesDirectory and testClassesDirectory in the surefire configuration and they work. The description of these two parameters is identical to testSourcesDirectory Regards, Marcin - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Surefire and testSourceDirectory
Well, the purpose is what the docs says: The test source directory containing test class sources. And it does work, otherwise no unit tests would work/run for any Maven project. As a convention, this param is defined in the Maven super pom. Have a look here: http://maven.apache.org/pom.html#The_Super_POM If you want to change this to some other directory and that causes problem in your IDE, that's a question for that IDE's Maven integration feature. It's not a Maven issue. If you do want to change the value of the testSourceDirectory param, you should do that in your project's pom. Do that in the same manner as it's defined in the super pom (not by a 'project.build.testSourceDirectory' property). /Anders On Tue, Jan 5, 2010 at 11:36, Marcin Kwapisz mkwap...@zsk.p.lodz.pl wrote: Hi, can someone tell me what is the purpose of testSourceDirectory in configuration of the surefire plugin. I do not think this parameter work at all. There is project.build.testSourceDirectory and I use it to point at my filtered test source files. But this method is very inconvenient due to NetBeans IDE - there is no Test Packages in project tree then. Is there another way to tell compiler where test sources are? I tried to set project.build.testSourceDirectory (outside pom.xml) in profiles.xml, but it doesn't work. Thanks in advance Regards -- Marcin Kwapisz - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: Surefire and testSourceDirectory
Well, the purpose is what the docs says: The test source directory containing test class sources. And it does work, otherwise no unit tests would work/run for any Maven project. As a convention, this param is defined in the Maven super pom. [Marcin Kwapisz] Source files are not run. You mean testClassesDirectory. This property must be set to directory where compiled test classes are placed. testSourceDirectory can be set in surefire configuration to whatever directory, and tests work properly. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Surefire and testSourceDirectory
off topic: If the testSourceDirectory param isn't set correctly, unit test source files wouldn't be found and thus not run (as they cannot be compiled). /Anders On Tue, Jan 5, 2010 at 12:41, Marcin Kwapisz mkwap...@zsk.p.lodz.pl wrote: Well, the purpose is what the docs says: The test source directory containing test class sources. And it does work, otherwise no unit tests would work/run for any Maven project. As a convention, this param is defined in the Maven super pom. [Marcin Kwapisz] Source files are not run. You mean testClassesDirectory. This property must be set to directory where compiled test classes are placed. testSourceDirectory can be set in surefire configuration to whatever directory, and tests work properly. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Surefire and testSourceDirectory
Hi Usually i use the tag testSourceDirectory in order to indicate if tests are for integration (testSourceDirectorysrc/it/testSourceDirectory) or for unit tests (testSourceDirectorysrc/test/testSourceDirectory) I use 2 modules, one for unit tests and another for integration tests Roland Marcin Kwapisz a écrit : Hi, can someone tell me what is the purpose of testSourceDirectory in configuration of the surefire plugin. I do not think this parameter work at all. There is project.build.testSourceDirectory and I use it to point at my filtered test source files. But this method is very inconvenient due to NetBeans IDE - there is no Test Packages in project tree then. Is there another way to tell compiler where test sources are? I tried to set project.build.testSourceDirectory (outside pom.xml) in profiles.xml, but it doesn't work. Thanks in advance - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: Surefire and testSourceDirectory
Usually i use the tag testSourceDirectory in order to indicate if tests are for integration (testSourceDirectorysrc/it/testSourceDirectory) or for unit tests (testSourceDirectorysrc/test/testSourceDirectory) I use 2 modules, one for unit tests and another for integration tests [[Marcin Kwapisz]] The following configuration doesn't work, testSourceDirectory under surefire plugin configuration can be set to any directory: build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-plugin/artifactId version2.4.3/version configuration testSourceDirectory${project.build.directory}/filteredTestSources/testSourceDirectory /configuration /plugin /plugins /build And that one of course works (I use it), and if there is no test sources, no test will be compiled and run: build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-plugin/artifactId version2.4.3/version /plugin /plugins testSourceDirectory${project.build.directory}/filteredTestSources/testSourceDirectory /build I attached simple example to this email, but I do not know if the list server accept it Regards Marcin - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: Surefire and testSourceDirectory
Sorry, attachments are not accepted. It is my pom.xml project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; modelVersion4.0.0/modelVersion groupIdpl.zsk.samples/groupId artifactIdSurefireFiltering/artifactId packagingjar/packaging version1.0-SNAPSHOT/version nameSurefireFiltering/name urlhttp://maven.apache.org/url build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version2.1/version configuration source1.6/source target1.6/target encoding${project.build.sourceEncoding}/encoding /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-resources-plugin/artifactId version2.4.1/version configuration encoding${project.build.sourceEncoding}/encoding /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-plugin/artifactId version2.4.3/version configuration !--classesDirectory${project.build.directory}/testclassesdir/classesDirectory-- !--testClassesDirectory${project.build.directory}/filteredTestClasses/testClassesDirectory-- testSourceDirectorysrc/test/whatever/testSourceDirectory /configuration /plugin /plugins /build dependencies dependency groupIdjunit/groupId artifactIdjunit/artifactId version4.7/version scopetest/scope /dependency /dependencies properties project.build.sourceEncodingUTF-8/project.build.sourceEncoding filteredValuePrzefiltrowano/filteredValue /properties /project - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Surefire and testSourceDirectory
artifactIdmaven-surefire-plugin/artifactId configuration testSourceDirectorysrc/test/whatever/testSourceDirectory This is simply not where testSourceDirectory goes in the pom. The Surefire plugin does not look for this value where you've put it, therefore it has no effect on your build which is correct. Refer to the XSD [1] (search for testSourceDirectory) and the Surefire plugin docs [2]. [1] http://maven.apache.org/xsd/maven-4.0.0.xsd [2] http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#testSourceDirectory Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org