[ 
http://jira.codehaus.org/browse/MEXEC-91?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=253732#action_253732
 ] 

Benjamin Bentmann commented on MEXEC-91:
----------------------------------------

bq. Which is wrong because you're in the compile phase and maven should not be 
looking for test scoped dependencies.
Your last example binds {{surefire:test}} to the {{compile}} phase so as per 
your configuration, test scoped dependencies are required to run Surefire.

Back to the original issue, the need for 
[exec:java|http://mojo.codehaus.org/exec-maven-plugin/java-mojo.html] to 
resolve test scoped dependencies is documented but there's surely room for 
improvement to only resolve dependencies that are actually required as per the 
{{classpathScope}} parameter.

> exec:java causes mvn compile to look for test-jar dependencies
> --------------------------------------------------------------
>
>                 Key: MEXEC-91
>                 URL: http://jira.codehaus.org/browse/MEXEC-91
>             Project: Maven 2.x Exec Plugin
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.2
>         Environment: Mac OS X, maven 2 and 3
>            Reporter: Steven Bethard
>         Attachments: mvn-compile-bug.tgz, mvn-compile-bug.tgz
>
>
> There is a bad interaction between the exec:java plugin and test-jar 
> dependencies in a multi-module project. In short, if you attach exec:java to 
> an execution phase, "mvn compile" then looks for "test-jar" dependencies even 
> though it should only be looking for compile time dependencies.
> Here is the setup:
> /pom.xml
> /cleartk-token/pom.xml
> /cleartk-token/src/main/java/Token.java
> /cleartk-token/src/test/java/TokenTest.java
> /cleartk-named-entity/pom.xml
> The cleartk-token module uses the "maven-jar-plugin" to package a "test-jar" 
> dependency.
> The cleartk-named-entity module depends on the cleartk-token "jar" dependency 
> at compile time and (additionally) the cleartk-token "test-jar" dependency at 
> test-compile time.
> The cleartk-named-entity module uses exec:java to generate some code in the 
> process-resources phase. (It doesn't actually call any main class in the 
> attached file, but that doesn't seem to be necessary to provoke the bug.)
> Given this setup, if you run "mvn compile" from the top level, with maven 2 
> you'll get the error:
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Failed to resolve artifact.
> Missing:
> ----------
> 1) org.cleartk:cleartk-token:test-jar:tests:0.7.0-SNAPSHOT
> And with maven 3 you'll get the error:
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> ...
> [ERROR] Failed to execute goal on project cleartk-named-entity: Could not 
> resolve dependencies for project 
> org.cleartk:cleartk-named-entity:jar:0.1.0-SNAPSHOT: Could not find artifact 
> org.cleartk:cleartk-token:jar:tests:0.7.0-SNAPSHOT
> Now this seems wrong in both cases - at compile time, maven shouldn't be 
> looking for test jars.
> I believe this is an exec:java bug (or at least exec:java revealing a 
> compiler plugin bug) because if I comment out the <executions> element for 
> the "maven-exec-plugin", then everything compiles fine.
> My current workaround is to use "mvn compile package" which I guess makes the 
> "test-jar" dependency visible at compile time. But since the "test-jar" 
> dependency is a test-compile time dependency, I think this shouldn't be 
> necessary.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to