My project structure looks like this:
parent POM
|-- app-core
|-- app-model
|-- app-services
`-- app-web
In my pom.xml
for app-web
:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<webDefaultXml>src/test/resources/webdefault.xml</webDefaultXml>
</configuration>
</plugin>
Hot deployment works properly and have no issues with mvn jetty:run
Question : app-core uses springs how can I configure this JNDI for Jetty maven plugin in this multi-module hierarchy which should be accessible in app-core module
Update :
Have added pom.xml like this
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>
<jettyConfig>src/main/resources/jetty.xml</jettyConfig>
</configuration>
</plugin>
And my jetty.xml looks like this :
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="icatDB" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/testDB</Arg>
<Arg>
<New class="net.sourceforge.jtds.jdbcx.JtdsDataSource">
<Set name="serverName">localhost</Set>
<Set name="databaseName">test</Set>
<Set name="user">sa</Set>
<Set name="password"></Set>
</New>
</Arg>
</New>
</Configure>
After that when i run mvn jetty:run I get this error
Failure: Object is not of type class org.mortbay.jetty.webapp.WebAppContext
Ok this works for me :
I need to use jettyEnvXml instead of jettyConfig.
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>
<jettyEnvXml>src/main/resources/jetty.xml</jettyEnvXml>
</configuration>
</plugin>