maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Barlock" <barl...@us.ibm.com>
Subject Re: maven-compiler-plugin cannot find class files in WEB-INF/classes
Date Mon, 14 Dec 2015 00:07:23 GMT
Thanks Robert.  I opened some of the Apache jars that have been 
OSGi-enabled and they just put the classes and/or JARs in the root of the 
JAR and specify the appropriate packages on Import-Packages and 
Export-Package in the MANIFEST.  Your best practice is a little more 
"pure" in terms of generating a "proper" OSGi bundle -- at the expense of 
more more project to build the JAR for the bundle.

Chris

IBM Middleware
Research Triangle Park, NC
(919) 224-2240
Internet:  barlock@us.ibm.com



From:   "Robert Scholte" <rfscholte@apache.org>
To:     "Maven Users List" <users@maven.apache.org>
Date:   12/12/2015 07:07 AM
Subject:        Re: maven-compiler-plugin cannot find class files in 
WEB-INF/classes



Hi Chris,

this isn't really a maven-compiler-plugin issue. This is how the java 
compiler (JAVA_HOME/bin/javac) works, or to be more precise: how the 
classpath works.
It expects that the packages are in the root of the archive, not in a 
subdirectory like WEB-INF/classes.

Best practice in this case: have a separate Maven module for the classes 
and include it as jar dependency to your war or generate an extra jar with 
 
your war containing the classes [1]. You'll get an extra 
webapp-1.0-SNAPSHOT-classes.jar. If you want to use this, add 
<classifier>classes</classifier> to your dependency.

thanks,
Robert

[1] 
http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#archiveClasses



Op Sat, 12 Dec 2015 01:19:11 +0100 schreef Chris Barlock 
<barlock@us.ibm.com>:

> I used the maven-bundle-plugin to create a Web Application Bundle in 
> which
> the class files are in WEB-INF/classes and the MANIFEST.MF confirms 
this:
>
> Bundle-ClassPath: WEB-INF/classes
>
> If I try to use this WAB (packaged as a JAR) as a dependency for the
> maven-compiler-plugin, it can't find any of the class files in the JAR. 
> If
> I change the JAR such that the class files are in the root of the JAR
> rather than in WEB-INF classes, then maven-compiler-plugin is happy.  Is
> it possible to use WABs with the maven-compiler-plugin?
>
> Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org





Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message