Hendricks, Brad K Mr CTR USA HRC
2008-09-03 17:34:20 UTC
Classification: UNCLASSIFIED
Caveats: NONE
Hello,
I've been developing an application using the Jetty Maven plugin and the
run goal. My application is using a JNDI reference for a datasource,
which I have configured using a jetty-env.xml file like:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.11</version>
<configuration>
<jettyEnvXml>target/test-classes/jetty-env.xml</jettyEnvXml>
</configuration>
...
</plugin>
This works fine for the run goal, but I now need to use the run-war
goal, and it seems to ignore the jettyEnvXml setting. A quick googling
turned up that this issue seems to have come up before, and was fixed a
while ago - http://jira.codehaus.org/browse/JETTY-285. However, I can't
seem to get a JNDI datasource defined so that it is recognized by
run-war. I've basically come down to two different approaches:
1. Configure jetty.xml to define the datasource. I can't seem to get
this to work. I think that the problem here is that jetty.xml defines a
server context, and I need to turn on JNDI for a webapp context. I
think that by defining a specific webapp context inside jetty.xml it
might work, but I wanted to avoid that so that the whole setup is a
little bit more dynamic.
2. Get the <webAppConfig> element of the plugin to recognize
jetty-env.xml. This seems like it should be possible, as the
webAppConfig is an instance of Jetty6PluginWebAppContext, which has a
property for the env file:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.11</version>
<configuration>
<webAppConfig>
<jettyEnvXmlFile>target/test-classes/jetty-env.xml</jettyEnvXmlFile>
</webAppConfig>
</configuration>
...
</plugin>
This doesn't seem to work either.
So, does anyone know the proper incantation to bind a JNDI datasource
that works with the run-war goal? I'd also like to ask the Jetty
developers if there is some reason why the run goal supports the env
file while the other goals do not? It seems like it would be possible
to move this support from AbstractJettyRunMojo to AbstractJettyMojo so
that all the goals could use it. Any thoughts on that?
Thanks.
Brad Hendricks
Classification: UNCLASSIFIED
Caveats: NONE
Caveats: NONE
Hello,
I've been developing an application using the Jetty Maven plugin and the
run goal. My application is using a JNDI reference for a datasource,
which I have configured using a jetty-env.xml file like:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.11</version>
<configuration>
<jettyEnvXml>target/test-classes/jetty-env.xml</jettyEnvXml>
</configuration>
...
</plugin>
This works fine for the run goal, but I now need to use the run-war
goal, and it seems to ignore the jettyEnvXml setting. A quick googling
turned up that this issue seems to have come up before, and was fixed a
while ago - http://jira.codehaus.org/browse/JETTY-285. However, I can't
seem to get a JNDI datasource defined so that it is recognized by
run-war. I've basically come down to two different approaches:
1. Configure jetty.xml to define the datasource. I can't seem to get
this to work. I think that the problem here is that jetty.xml defines a
server context, and I need to turn on JNDI for a webapp context. I
think that by defining a specific webapp context inside jetty.xml it
might work, but I wanted to avoid that so that the whole setup is a
little bit more dynamic.
2. Get the <webAppConfig> element of the plugin to recognize
jetty-env.xml. This seems like it should be possible, as the
webAppConfig is an instance of Jetty6PluginWebAppContext, which has a
property for the env file:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.11</version>
<configuration>
<webAppConfig>
<jettyEnvXmlFile>target/test-classes/jetty-env.xml</jettyEnvXmlFile>
</webAppConfig>
</configuration>
...
</plugin>
This doesn't seem to work either.
So, does anyone know the proper incantation to bind a JNDI datasource
that works with the run-war goal? I'd also like to ask the Jetty
developers if there is some reason why the run goal supports the env
file while the other goals do not? It seems like it would be possible
to move this support from AbstractJettyRunMojo to AbstractJettyMojo so
that all the goals could use it. Any thoughts on that?
Thanks.
Brad Hendricks
Classification: UNCLASSIFIED
Caveats: NONE