|
Brian, it works if you use test-jar in a test scope, which is the usual case. Your main classes shuldn't depend on test classes from other modules Yes, I realize this is an unusual case. The code is something we are working to fix, but it was working until I moved it into a common parent in preparation for some other stuff. It seems by extension this would be a problem for other dependencies that use classifiers. We have the normal case, but it won't work unless we before an install first. We have the normal case, but it won't work unless we do an install first. So mvn clean install on the project will run the tests correctly. This issue still occurs for me. Tested with maven 2.0.6 and 2.0.7. I still have to run a install first. We're also running into this problem, which is that:
I know we shouldn't have a dependency from the main code of B to a test artifact of project A, but it would make my job considerably easier if this "just worked", or even if it also failed when only building project B. This should be fixed. If you can reproduce, please make an IT test and attach. Instructions for an IT are here: http://docs.codehaus.org/display/MAVEN/Creating+a+Maven+Integration+Test Attaching mng-2045-ittest.zip, which contains an integration test reproducing the problem. Well, at least "on-my-machine" anyway. Tested with maven 2.0.7. This patch has a slight enhancement over the first one I submitted. The problem with the first, is that if "clean compile" is run in a multi-module project, then the test-classes directory does not exist. So this patch checks for the existence of the test output directory. And if it does not exist, it falls back to the repository. Brian, I find both sample projects (it1021.tar.gz and sample.zip) not working in 2.0.8). Can you comment on this, please? Thanks Tomas this was fixed in 2.0.8 - sample.zip, it1021.tar.gz and the integration all test with it. Please open a new issue with more specifics if you are still seeing the problem. I don't think this bug is fixed. If I download sample.zip and run 'mvn test-compile', I get the following: jpollak@Challenger:~/src$ cd sample/ Missing: Try downloading the file manually from the project website. Then, install it using the command: Alternatively, if you host your own repository you can deploy the file there: Path to dependency: ---------- for artifact: from the specified remote repositories: [INFO] ------------------------------------------------------------------------ I am seeing the same behavior with maven 2.0.9 when trying to build logback. See In this particular case, logback-classic depends on logback-core as follows: <dependency> <dependency> For a pristine installation, 'mvn package' fails with =================== Try downloading the file manually from the project website. Path to dependency: =================== whereas 'mvn install' works fine. The SLF4J project which I maintain suffers from the same problem. See http://svn.slf4j.org/repos/slf4j/trunk/ For whatever it is worth, you may define the dependency as <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <type>test-jar</type> <scope>test</scope> </dependency> at least such a declaration works in quite some of our projects. Thank you Joerg. The change you suggested worked beautifully. The documentation has been fixed in r709688 could this be considered fixed in 2.0.10 and a new issue opened for the classifier approach? The issue that was originally reported here, i.e. a bad compile class path when depending on a test JAR and running the install phase of a reactor build, was fixed in 2.0.8. Other issues like only running the test phase ( I have attemted Joerg's suggestion, and I am afraid that I am experiencing the same problem with maven 2.1.0. So it does not appear that this issue has been fixed for multi-module projects. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Integration test.
If classes are moved to test folder and dependency set as test scope it works fine, using the jar from repo
If trying to use in compile scope it references ../child1/target/classes twice in the compiler classpath