Jetty 想要 Jersey,但我没有使用它
Jetty wants Jersey, but I'm not using it
按照此处的说明构建一个相对简单的码头应用程序:
http://www.eclipse.org/jetty/documentation/9.4.x/maven-and-jetty.html
我没有使用 Jersey,但是 mvn jetty:run 抱怨
Provider com.sun.jersey.server.impl.container.servlet.JerseyServletContainerInitializer not found
我的 pom.xml 不包含对泽西岛的任何引用。其实很简单:
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>6.0.1</version>
</dependency>
是什么让码头寻找泽西岛?
在所有依赖项中搜索 META-INF/services/javax.servlet.ServletContainerInitializer
个文件。
具有 com.sun.jersey.server.impl.container.servlet.JerseyServletContainerInitializer
条目的那个是给您带来问题的那个。
查看您的项目依赖项(又名 <project><dependencies>
)和您项目的 jetty-maven-plugin
配置,看看 <plugin>
是否有任何额外的添加到它的依赖项(又名 <plugin><dependencies>
)。
好吧,经过多次阴谋诡计和咬牙切齿,我想我偶然发现了答案。在学习 Maven 的同时,我在玩 shaded uber-jars。我已经将其中一个包编译为 uper-jar,并安装了它。当 maven 将它们放在一起时,它添加了太多并且破坏了我的依赖性。删除用于本地安装的阴影 jar 并仅将其用于分发工作得很好。
按照此处的说明构建一个相对简单的码头应用程序:
http://www.eclipse.org/jetty/documentation/9.4.x/maven-and-jetty.html
我没有使用 Jersey,但是 mvn jetty:run 抱怨
Provider com.sun.jersey.server.impl.container.servlet.JerseyServletContainerInitializer not found
我的 pom.xml 不包含对泽西岛的任何引用。其实很简单:
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>6.0.1</version>
</dependency>
是什么让码头寻找泽西岛?
在所有依赖项中搜索 META-INF/services/javax.servlet.ServletContainerInitializer
个文件。
具有 com.sun.jersey.server.impl.container.servlet.JerseyServletContainerInitializer
条目的那个是给您带来问题的那个。
查看您的项目依赖项(又名 <project><dependencies>
)和您项目的 jetty-maven-plugin
配置,看看 <plugin>
是否有任何额外的添加到它的依赖项(又名 <plugin><dependencies>
)。
好吧,经过多次阴谋诡计和咬牙切齿,我想我偶然发现了答案。在学习 Maven 的同时,我在玩 shaded uber-jars。我已经将其中一个包编译为 uper-jar,并安装了它。当 maven 将它们放在一起时,它添加了太多并且破坏了我的依赖性。删除用于本地安装的阴影 jar 并仅将其用于分发工作得很好。