You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Charles McCallum <mc...@pobox.upenn.edu> on 2009/05/06 17:57:46 UTC
System scope dependency can't find class in rt.jar?
I need to reference WSBindingProvider, a class in the standard rt.jar:
package edu.upenn.library.itadd.dla.fedora;
...
import com.sun.xml.internal.ws.developer.WSBindingProvider;
...
WSBindingProvider bp = (WSBindingProvider)port;
...
This builds fine in Eclipse (without maven), but when I try to build from the commandline I get this:
...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
/usr/local/dla-input/lib/java/FedoraPost/src/main/java/edu/upenn/library/itadd/dla/fedora/Post.java:[16,40] package com.sun.xml.internal.ws.developer does not exist
/usr/local/dla-input/lib/java/FedoraPost/src/main/java/edu/upenn/library/itadd/dla/fedora/Post.java:[101,5] cannot find symbol
symbol : class WSBindingProvider
location: class edu.upenn.library.itadd.dla.fedora.Post
...
I've tried several different things in the POM, but they make no difference. Here's one permutation:
<dependency>
<groupId>dummy</groupId>
<artifactId>dummy</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>/usr/lib/jvm/newest/jdk/jre/lib/rt.jar</systemPath>
</dependency>
-- As I understand it, this is an appropriate use of system scope: This class should just be available through the JDK on any installation.
-- If I could get it to work, I'd certainly use a property reference in the systemPath, but here I'm specifying the path explicitly so there's one less variable.
-- For system scope, my understanding is that the groupId, artifactId, and version can be arbitrary. For example, http://mail-archives.apache.org/mod_mbox/maven-users/200710.mbox/%3C4725B62A.3080800@udo.edu%3E
I have a work-around: that is to strip the rt.jar down to just the subpackage we need, and put it in our local repository, but that really doesn't seem like the right thing to do. Any suggestions?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: System scope dependency can't find class in rt.jar?
Posted by Brett Randall <ja...@gmail.com>.
Long shot - I know that "newest" in /usr/lib/jvm/newest/jdk/jre/lib/rt.jar
suggests it is a JDK6 JDK, but might be worth double-checking on the build
machine, in case a JDK5 slipped in unnoticed (which won't have this class).
I see you've extracted the classes from the JAR, but maybe you did this from
a different copy.
Brett
On Thu, May 7, 2009 at 1:57 AM, Charles McCallum <mc...@pobox.upenn.edu>wrote:
> I need to reference WSBindingProvider, a class in the standard rt.jar:
>
> package edu.upenn.library.itadd.dla.fedora;
> ...
> import com.sun.xml.internal.ws.developer.WSBindingProvider;
> ...
> WSBindingProvider bp = (WSBindingProvider)port;
> ...
>
> This builds fine in Eclipse (without maven), but when I try to build from
> the commandline I get this:
>
> ...
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Compilation failure
>
> /usr/local/dla-input/lib/java/FedoraPost/src/main/java/edu/upenn/library/itadd/dla/fedora/Post.java:[16,40]
> package com.sun.xml.internal.ws.developer does not exist
>
> /usr/local/dla-input/lib/java/FedoraPost/src/main/java/edu/upenn/library/itadd/dla/fedora/Post.java:[101,5]
> cannot find symbol
> symbol : class WSBindingProvider
> location: class edu.upenn.library.itadd.dla.fedora.Post
> ...
>
> I've tried several different things in the POM, but they make no
> difference. Here's one permutation:
>
> <dependency>
> <groupId>dummy</groupId>
> <artifactId>dummy</artifactId>
> <version>1</version>
> <scope>system</scope>
> <systemPath>/usr/lib/jvm/newest/jdk/jre/lib/rt.jar</systemPath>
> </dependency>
>
> -- As I understand it, this is an appropriate use of system scope: This
> class should just be available through the JDK on any installation.
>
> -- If I could get it to work, I'd certainly use a property reference in the
> systemPath, but here I'm specifying the path explicitly so there's one less
> variable.
>
> -- For system scope, my understanding is that the groupId, artifactId, and
> version can be arbitrary. For example,
> http://mail-archives.apache.org/mod_mbox/maven-users/200710.mbox/%3C4725B62A.3080800@udo.edu%3E
>
>
> I have a work-around: that is to strip the rt.jar down to just the
> subpackage we need, and put it in our local repository, but that really
> doesn't seem like the right thing to do. Any suggestions?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: System scope dependency can't find class in rt.jar?
Posted by Baptiste MATHUS <ml...@batmat.net>.
Well, this is a common bad practice to import packages like sun.* or
com.sun.*. PMD has even a standard rule to check this pattern.
This can particularly be a problem when deploying on other JVM than sun's.
But if you really really must have a dependency against this jar, then I
would proceed with standard dependency management :
* deploy the right rt.jar in your repository manager
* add the dependency against it
The thing is I'm unsure it will work fine since I seem to remember that some
classes are handled specifically by the classloading system. This one could
be one of those.
HTH
Cheers.
2009/5/6, Charles McCallum <mc...@pobox.upenn.edu>:
>
> I need to reference WSBindingProvider, a class in the standard rt.jar:
>
> package edu.upenn.library.itadd.dla.fedora;
> ...
> import com.sun.xml.internal.ws.developer.WSBindingProvider;
> ...
> WSBindingProvider bp = (WSBindingProvider)port;
> ...
>
> This builds fine in Eclipse (without maven), but when I try to build from
> the commandline I get this:
>
> ...
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Compilation failure
>
> /usr/local/dla-input/lib/java/FedoraPost/src/main/java/edu/upenn/library/itadd/dla/fedora/Post.java:[16,40]
> package com.sun.xml.internal.ws.developer does not exist
>
> /usr/local/dla-input/lib/java/FedoraPost/src/main/java/edu/upenn/library/itadd/dla/fedora/Post.java:[101,5]
> cannot find symbol
> symbol : class WSBindingProvider
> location: class edu.upenn.library.itadd.dla.fedora.Post
> ...
>
> I've tried several different things in the POM, but they make no
> difference. Here's one permutation:
>
> <dependency>
> <groupId>dummy</groupId>
> <artifactId>dummy</artifactId>
> <version>1</version>
> <scope>system</scope>
> <systemPath>/usr/lib/jvm/newest/jdk/jre/lib/rt.jar</systemPath>
> </dependency>
>
> -- As I understand it, this is an appropriate use of system scope: This
> class should just be available through the JDK on any installation.
>
> -- If I could get it to work, I'd certainly use a property reference in the
> systemPath, but here I'm specifying the path explicitly so there's one less
> variable.
>
> -- For system scope, my understanding is that the groupId, artifactId, and
> version can be arbitrary. For example,
> http://mail-archives.apache.org/mod_mbox/maven-users/200710.mbox/%3C4725B62A.3080800@udo.edu%3E
>
>
> I have a work-around: that is to strip the rt.jar down to just the
> subpackage we need, and put it in our local repository, but that really
> doesn't seem like the right thing to do. Any suggestions?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
--
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !