java - Jetty 9 Maven 插件未正确设置 defaultsDescriptor

标签 java maven configuration jetty jetty-9

我目前正在使用具有以下定义的 Maven 插件运行 Jetty 9:

pom.xml

<properties>
  <jetty.version>9.1.3.v20140225</jetty.version>
</properties>

<pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-maven-plugin</artifactId>
      <version>${jetty.version}</version>
      <dependencies>
        <dependency>
          <groupId>org.ow2.asm</groupId>
          <artifactId>asm</artifactId>
          <version>${asm.version}</version>
        </dependency>
      </dependencies>
    </plugin>
  </plugins>
</pluginManagement>

Web 项目 pom.xml

<plugins>
  <plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <configuration>
      <httpConnector>
        <port>8888</port>
        <idleTimeout>60000</idleTimeout>
      </httpConnector>
      <scanIntervalSeconds>10</scanIntervalSeconds>
      <stopKey>StopTouchingMe</stopKey>
      <stopPort>8889</stopPort>
      <systemProperties>
        <systemProperty>
          <name>com.pearson.platformj.server.root</name>
          <value>${project.basedir}/target</value>
        </systemProperty>
      </systemProperties>
      <webApp>
        <contextPath>/</contextPath>
      </webApp>
      <webAppConfig>
        <defaultsDescriptor>src/main/resources/webdefault.xml</defaultsDescriptor>
      </webAppConfig>
    </configuration>
  </plugin>
</plugins>

我需要覆盖默认的 webdefault.xml 以便我可以在 Windows 上进行开发。但是当我执行 mvn jetty:run 时,我看到了

[INFO] --- jetty-maven-plugin:9.1.3.v20140225:run (default-cli) @ web ---
[INFO] Configuring Jetty for project: web
[INFO] webAppSourceDirectory not set. Trying src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = E:\Ideas\xte\XTE\web\target\classes
[INFO] Context path = /
[INFO] Tmp directory = E:\Ideas\xte\XTE\web\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = file:/E:/Ideas/xte/XTE/web/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = E:\Ideas\xte\XTE\web\src\main\webapp

如您所见,webdefault.xml 是从默认位置提取的,而不是从指定位置提取的。任何帮助将不胜感激。

最佳答案

问题是 webAppConfigwebApp 的别名,因此您应该删除它并将 defaultsDescriptor 添加到 webApp 相反:

<webApp>
    <contextPath>/</contextPath>
    <defaultsDescriptor>src/main/resources/webdefault.xml</defaultsDescriptor> 
</webApp>

关于java - Jetty 9 Maven 插件未正确设置 defaultsDescriptor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23394716/

相关文章:

java - 部署在服务器上时,Grails TimeZone 3 小时偏移

java - spring data JPA repository 中的解析和查询构建在哪个类?

java - 应考虑使用 whatsapp 与客户通信的 API

maven - 如何使用 jib 正确 dockerize maven 项目

Mysql:如何配置 mysql 代理以进行故障转移处理

java - 在实现中使用接口(interface)类型与公共(public)接口(interface)

java - 无法执行目标 Maven/Eclipse

java - Spring 创建两个 @Configuration bean 启动

javascript - 允许用户通过 json 对象配置设置

java - 时间戳字段的自定义打印