java - maven: exclude jar from JDK -
java - maven: exclude jar from JDK -
so, i've been searching hours , hours , i'm running brick wall here.
my problem's quite simply: i've got (pretty big) project i'd beingness built maven (so can automate bit). works fine far except 1 major problem.
i've got dependency called "java-plugin" - don't know origin or author, in dependencies of dependency of mine - added our own nexus 3rd party repository name original jar given.
this plugin gets added nexus without problems, has next structure:
- netscape -- javascript jsexception.class jsobject.class jsutil.class -- security forbiddentargetexception.class parameterizedtarget.class principal.class privilege.class privilegemanager.class privilegetable.class target.class userdialoghelper.class usertarget.class - sun -- plugin ... -- plugin2 ... - com.sun.java.browser.plugin2 ...
what's problem? long working in eclipse based project, placed jdk "last" 1 on classpath. it's maven , apparently maven places jdk first. in jdk have jfxrt.jar
(part of java fx). 1 also contains netscape.javascript.jsobject
object (and netscape.javascript.jsexception
object). doesn't contains netscape.javascript.jsutil
object on other hand. maven picks jsobject
, jsexception
jdk library, , other classes picks own java-plugin dependency.
of course of study both classes not same. of course of study compilation errors java-plugin dependency contains 'getwindow' method in jsobject
class jdk library doesn't.
the ideal situation exclude jfxrt.jar
maven, have absolutely no thought on how that. other solution too, long 1 build maven. note: i'd rather not want utilize "endorse" mechanism in java if possible, require uploading library several different servers on , on 1 time again , cause huge delays in deployment (as we'd have sent file our back upwards team yet upload).
thanks!
edit
so, plugin dependency in jdk - better! don't need java-plugin, i've got plenty jdk includes plugin.jar automatically (it's in ${java.home}/lib/plugin.jar
).
now have situation:
as can see, jfxrt.jar comes first, before plugin.jar. can see why maven, or java more generally, stops looking finds first netscape.javascript.jsobject
(which in jfxrt.jar). need load sec jsobject class (which unfortunately happens in same bundle , same name). how hell supposed this? , why did work without charm in eclipse, when wasn't using maven, , why doesn't work in intellij, maven?
thanks in advance!
ok, figured out. apparently much more of intellij issue of classpath issue.
so intellij automatically adds total jdk (including jars in /jre/lib) classpath - first, before maven dependencies. caused project going weird: had netscape.javascript.jsobject
in jfxrt.jar
, in plugin.jar
, in maven plugin (these jars added in order). first jsobject found 1 in jfxrt.jar
, caused problem.
it worked in eclipse there, alter classpath order , had added maven plugin before jdk - order became java-plugin.jar
(first one, right jsobject class), jfxrt.jar
, plugin.jar
.
it have worked when i'd utilize older jdk - jfxrt.jar
added in jdk7.
it works on jenkins, if still have java-plugin.jar
maven, because jenkins not automatically add together jdk libraries (only core). how cleared out:
i removed own java.plugin.jar
, replaced dependency on plugin.jar
.
<dependency> <groupid>com.sun.jdk</groupid> <artifactid>plugin</artifactid> <version>${version.java-plugin}</version> <type>jar</type> <scope>system</scope> <systempath>${java.home}/lib/plugin.jar</systempath> </dependency>
i still had problem in intellij, arrived remove jfxrt.jar
imported jdk libraries in intellij - alter .iml
file of course of study not of utilize jenkins. (you can edit these settings right clicking on external libraries > < 1.7> folder in project browser, , clicking open library settings
).
jfxrt.jar
removed, worked. reasoned wouldn't alter in jenkins, on other hand, problem maybe wouldn't exist on jenkins. tried , commited code svn build on jenkins. magically, works on jenkins too. tried , removed dependency on plugin.jar
, classical "could not find symbol" compilation error on jenkins - while don't error in intellij, due automatically importing of jdk on classpath.
long story short: editing project settings in intellij got working locally, trusting maven got working on jenkins, way should.
java eclipse maven jar
Comments
Post a Comment