简体   繁体   English

防止Netbeans 8.0自动添加Jersey / Glassfish依赖项

[英]Prevent Netbeans 8.0 from adding Jersey / Glassfish dependencies automatically

Surprisingly, I can say after a lot of search that none on earth has ever had this problem, but it's a quite strange behaviour! 出人意料的是,经过大量搜索,我可以说地球上从来没有一个问题出现过,但这是一个非常奇怪的行为!

I recently moved to Netbeans 8 from eclipse kepler. 我最近从eclipse kepler移到了Netbeans 8。 My environment is Wildfly with Resteasy/Jax-rs. 我的环境是带有Resteasy / Jax-rs的Wildfly。 So I do not want or need Jersey, Glassfish or whatever. 因此,我不需要或不需要球衣,Glassfish或其他任何东西。 If I need a new dependency I just add that one to my pom.xml, right? 如果需要新的依赖项,只需将其添加到pom.xml中,对吗? No, it doesn't seem so, It appears that Netbeans thinks that if you have a web application you must have Glassfish and Jersey in your project, so Netbeans add those dependencies automatically in my POMs, and having both resteasy and jersey in my classpath causes just a few problems. 不,似乎并非如此,看来Netbeans认为,如果您具有Web应用程序,则项目中必须具有Glassfish和Jersey,因此Netbeans将这些依赖项自动添加到我的POM中,并在我的类路径中同时包含resteasy和jersey只会引起一些问题。

I removed all jersey dependencies added to my POMs but sometimes, randomly, when I "mvn install" my project from netbeans I still have Jersey inside my war. 我删除了添加到POM中的所有jersey依赖项,但是有时候,当我从netbeans中“ mvn install”我的项目时,我的战争中仍然有Jersey。

Does anyone know why Jersey is added by default by Netbeans in my classpath.. and how to prevent it? 有谁知道为什么Netbeans在我的类路径中默认添加Jersey以及如何防止它?

Maybe you could trick your environment by adding the jersey dependency but mark it as provided . 也许您可以通过添加jersey依赖项来欺骗环境,但是将其标记为提供 So it would be there and Netbeans will not add another one but it is not within your WAR. 这样就可以了,Netbeans不会添加另一个,但是它不在您的WAR中。

<dependency>
    <groupId>.. jersey ..</groupId>
    <artifactId>.. jersey ..</artifactId>
    <version>.. jersey.version ..</version>
    <scope>provided</scope>
</dependency>

This seems to be filed as a bug for Netbeanx 7.x ( https://netbeans.org/bugzilla/show_bug.cgi?id=232922 ) and was closed . 这似乎是Netbeanx 7.x的一个错误( https://netbeans.org/bugzilla/show_bug.cgi?id=232922 ),已被关闭 Maybe you should reopen it, if it is still an issue for Netbeans 8.0. 如果它仍然是Netbeans 8.0的问题,也许您应该重新打开它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM