Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.4
-
Fix Version/s: 2.1.0, 3.0-alpha-3
-
Component/s: Plugins and Lifecycle
-
Labels:None
-
Complexity:Intermediate
-
Number of attachments :
Description
In a plugin I wrote (jspc), needs the dependency jars. It asks for this with the request for the project.compileClasspathElements. In a multiproject environment, when each project is built individually, it seems correct. Example (when run with -X ina subproject dir) showing classpath:
/Users/mbp/.m2/repository/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar
/Users/mbp/.m2/repository/taglibs/standard/1.1.2/standard-1.1.2.jar
/Users/mbp/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar
/Users/mbp/.m2/repository/tldtestapp/testexttld/1/testexttld-1.jar <-----------------NOTICE HERE - THIS IS AN ARTIFACT FROM ANOTHER SUBPROJECT
/Users/mbp/.m2/repository/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar]
When it is run from the Top level/Root project...here is the output:
Users/mbp/.m2/repository/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar
/Users/mbp/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar
/Users/mbp/.m2/repository/taglibs/standard/1.1.2/standard-1.1.2.jar
/Users/mbp/Desktop/jsp-example/TestTldProject/target/classes <----------------NOTICE - THE JAR IS NOT BEING ASKED FOR, BUT A CLASSES DIR INSTEAD
/Users/mbp/.m2/repository/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar]
The second project has a dependency on the testexttld-1.jar because it contains tag libs which must be wrapped in a jar. When run from a top level, it uses the other project's classes directory instead of the JAR artifact. WIth JSPC and taglibs, this makes it so it cannot work. If I have a dependency on a jar, that jar should be the dependency as expected and not a classes directory. For full explanation and example see here:
Issue Links
| This issue is duplicated by: | ||||
| MNG-4032 | Test jar dependency not available for for main classes in multi module builds |
|
|
|
| MNG-3420 | In a reactor, attached artifacts with classifier should be used when generating classpath, instead of the whole output directory of the related project |
|
|
|
| MNG-2151 | classpath used to build a module affects compile classpath for building another module |
|
|
|
| MNG-4608 | Cross module dependencies for multi-module projects |
|
|
|
| This issue relates to: | ||||
| MSHADE-42 | Reactor builds do not use shaded jar |
|
|
|
| MNG-2045 | Maven can't compile against sibling test-jar dependency in multiproject (Test Attached) |
|
|
|
| MNG-4248 | CLONE -Maven can't compile against sibling test-jar dependency in multiproject (Test Attached) |
|
|
|
| This issue is related to: | ||||
| MJSPC-4 | JSPs Cannot Be Compiled if They Depend on Tag Files |
|
|
|
This is also affecting Spring-OSGi...
The current Spring-OSGi build includes sub-projects to wrap existing Spring modules as OSGi bundles.
During this wrapping process, the bundle is created and installed without unpacking the jar, so the build
output directory (target/classes) is empty.
Later on in the build, other sub-projects have dependencies to the OSGified modules - but because the
dependent sub-projects are in the project references, the MavenProject class only adds the build output
directories to the compilation classpath (instead of the artifacts in the local repo).
This causes the build to fail, because the target/classes directories are empty - if the MavenProject class
also added the artifact jar as well as the output directory to the classpath then the build would pass.
Currently we are working around this problem by using the invoker plugin to separate the build cycles.