TheChrisPratt
TheChrisPratt

Reputation: 473

Jetty 9 Maven Plugin not setting defaultsDescriptor properly

I'm currently running Jetty 9 using the Maven Plugin with the following definition:

Parent 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 Project 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>

I need to override the default webdefault.xml so that I can develop on Windows. but when I execute mvn jetty:run, I see

[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

As you can see, the webdefault.xml is being pulled from the default location, not from the specified location. Any help would be appreciated.

Upvotes: 2

Views: 2444

Answers (1)

Vlad Mihalcea
Vlad Mihalcea

Reputation: 154090

The problem is that webAppConfig is an alias to webApp, so you should remove it and add the defaultsDescriptor to the webApp instead:

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

Upvotes: 2

Related Questions