Discussion:
Maven Jetty Plugin won't honor webAppSourceDirectory
dizzyd
2011-09-06 13:59:07 UTC
Permalink
Based on the documentation the Jetty plugin is supposed to allow you to be
able to change the default location of the webapp directory
(http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin)

when I issue a mvn jetty:run in the plugin configuration I keep seeing this:

...
[INFO] webAppSourceDirectory : [PROJ-PATH]\src\main\webapp\ does not exist.
Defaulting to [PROJ-PATH]\src\main\webapp.
...
[INFO] web.xml file = [PROJ-PATH]\src\main\webapp\WEB-INF\web.xml
[INFO] webapp directory = [PROJ-PATH]\src\main\webapp
...

In my directory structure I do have the src\main\webapp directory, so I an
not sure why jetty isn't seeing it. Also when I attempt to change the
webapp directory jetty doesn't see that and attempts to use the default
again.

directory structure:

PROJ
PROJ\src
PROJ\src\webapp
PROJ\src\webapp\WEB-INF
PROJ\src\webapp\WEB-INF]web.xml
PROJ\src\webapp2
PROJ\src\webapp2\WEB-INF
PROJ\src\webapp2\WEB-INF]web.xml

Plugin config:
...
<plugin>
<groupId>org.mortbay.jetty<groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.22</version>
<configuration>

<webAppSourceDirectory>${basedir}/src/main/webapp2</webAppSourceDirectory>
<webXml>${basedir}/src/main/webapp2/WEB-INF/web.xml</webXml>
</configuration>
<plugin>
...

I have tried to use the webapp2 for the source dir and it doesn't recognize
it at all, maven doesn't seem to be reading the configuration at all. Also
tried to use the webpp default configuration, and that initial error is
still displayed:

[INFO] webAppSourceDirectory : [PROJ-PATH]\src\main\webapp\ does not exist.
Defaulting to [PROJ-PATH]\src\main\webapp.

Any direction on this? All of the documentation suggests that this should
work.

--
View this message in context: http://maven.40175.n5.nabble.com/Maven-Jetty-Plugin-won-t-honor-webAppSourceDirectory-tp4774500p4774500.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Jason van Zyl
2011-09-06 14:03:57 UTC
Permalink
You probably want to use the newer versions of Jetty, and the Jetty Maven Plugin, which is now an Eclipse project[1]. You can find the mailing lists here[2].

http://www.eclipse.org/jetty/mailinglists.php

[1]: http://www.eclipse.org/jetty/
[2]: http://www.eclipse.org/jetty/
Post by dizzyd
Based on the documentation the Jetty plugin is supposed to allow you to be
able to change the default location of the webapp directory
(http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin)
...
[INFO] webAppSourceDirectory : [PROJ-PATH]\src\main\webapp\ does not exist.
Defaulting to [PROJ-PATH]\src\main\webapp.
...
[INFO] web.xml file = [PROJ-PATH]\src\main\webapp\WEB-INF\web.xml
[INFO] webapp directory = [PROJ-PATH]\src\main\webapp
...
In my directory structure I do have the src\main\webapp directory, so I an
not sure why jetty isn't seeing it. Also when I attempt to change the
webapp directory jetty doesn't see that and attempts to use the default
again.
PROJ
PROJ\src
PROJ\src\webapp
PROJ\src\webapp\WEB-INF
PROJ\src\webapp\WEB-INF]web.xml
PROJ\src\webapp2
PROJ\src\webapp2\WEB-INF
PROJ\src\webapp2\WEB-INF]web.xml
...
<plugin>
<groupId>org.mortbay.jetty<groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.22</version>
<configuration>
<webAppSourceDirectory>${basedir}/src/main/webapp2</webAppSourceDirectory>
<webXml>${basedir}/src/main/webapp2/WEB-INF/web.xml</webXml>
</configuration>
<plugin>
...
I have tried to use the webapp2 for the source dir and it doesn't recognize
it at all, maven doesn't seem to be reading the configuration at all. Also
tried to use the webpp default configuration, and that initial error is
[INFO] webAppSourceDirectory : [PROJ-PATH]\src\main\webapp\ does not exist.
Defaulting to [PROJ-PATH]\src\main\webapp.
Any direction on this? All of the documentation suggests that this should
work.
--
View this message in context: http://maven.40175.n5.nabble.com/Maven-Jetty-Plugin-won-t-honor-webAppSourceDirectory-tp4774500p4774500.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder, Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

the course of true love never did run smooth ...

-- Shakespeare
dizzyd
2011-09-06 14:26:19 UTC
Permalink
got this fixed, thanks for the suggestion Jason.
Post by dizzyd
<plugin>
<groupId>org.mortbay.jetty<groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.22</version>
<configuration>
<webAppSourceDirectory>${basedir}/src/main/webapp2</webAppSourceDirectory>
<webXml>${basedir}/src/main/webapp2/WEB-INF/web.xml</webXml>
</configuration>
<plugin>
TO

<plugin>
<groupId>org.mortbay.jetty<groupId>
<artifactId>jetty-maven-plugin</artifactId> <------NOTE, changed name
to jetty-maven-plugin (looks like the artifact name changed in the newer
version)....also removed the version number

<configuration>


<webAppSourceDirectory>${basedir}/src/main/webapp2</webAppSourceDirectory>

</configuration>
<plugin>

--
View this message in context: http://maven.40175.n5.nabble.com/Maven-Jetty-Plugin-won-t-honor-webAppSourceDirectory-tp4774500p4774583.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Anders Hammar
2011-09-06 14:38:15 UTC
Permalink
Always specify a version number to ensure reproducable builds!

/Anders (mobile)
Post by dizzyd
got this fixed, thanks for the suggestion Jason.
Post by dizzyd
<plugin>
<groupId>org.mortbay.jetty<groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.22</version>
<configuration>
<webAppSourceDirectory>${basedir}/src/main/webapp2</webAppSourceDirectory>
Post by dizzyd
Post by dizzyd
<webXml>${basedir}/src/main/webapp2/WEB-INF/web.xml</webXml>
</configuration>
<plugin>
TO
<plugin>
<groupId>org.mortbay.jetty<groupId>
<artifactId>jetty-maven-plugin</artifactId> <------NOTE, changed name
to jetty-maven-plugin (looks like the artifact name changed in the newer
version)....also removed the version number
<configuration>
<webAppSourceDirectory>${basedir}/src/main/webapp2</webAppSourceDirectory>
</configuration>
<plugin>
--
http://maven.40175.n5.nabble.com/Maven-Jetty-Plugin-won-t-honor-webAppSourceDirectory-tp4774500p4774583.html
Post by dizzyd
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
dizzyd
2011-09-06 14:45:10 UTC
Permalink
Noted...added version number.

Thanks!


--
View this message in context: http://maven.40175.n5.nabble.com/Maven-Jetty-Plugin-won-t-honor-webAppSourceDirectory-tp4774500p4774652.html
Sent from the Maven - Users mailing list archive at Nabble.com.
dizzyd
2011-09-06 19:18:34 UTC
Permalink
A follow up.

We have a very large and complex system that is being deployed to jetty
6.1.22, so I'd like to try to keep things a close to the same as possible
with the plugin.
Post by dizzyd
<plugin>
<groupId>org.mortbay.jetty<groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.22</version>
<configuration>
<webAppSourceDirectory>${basedir}/src/main/webapp2</webAppSourceDirectory>
<webXml>${basedir}/src/main/webapp2/WEB-INF/web.xml</webXml>
</configuration>
<plugin>
when I do a mvn: jetty:run looks like it is looking for the newest version
of the plugin and defaulting to the "jetty-maven-plugin" (the newest one)
and skipping this configuration all together. I think this has something to
do with my plugin groups declaration in my settings.xml file:

...
<pluginGroups>
<pluginGroup>org.mortbay.jetty</pluginGroup>
</pluginGroups>
...

to get it to actually use the 6.1.22 version I have to use the fully
qualified plugin name as such:

mvn org.mortbay.jetty:maven-jetty-plugin:run

This uses the correct version of the plugin, but why? What setting is
telling maven to use the newer one when I call jetty:run?

--
View this message in context: http://maven.40175.n5.nabble.com/Maven-Jetty-Plugin-won-t-honor-webAppSourceDirectory-tp4774500p4775657.html
Sent from the Maven - Users mailing list archive at Nabble.com.
dizzyd
2011-09-07 13:55:57 UTC
Permalink
This link helped me to solve my issue:

http://maven.40175.n5.nabble.com/Does-the-lt-pluginGroup-gt-in-the-setting-xml-work-td115219.html


my metadata file for org.mortbay.jetty had configured the prefix to always
call jetty-maven-plugin vs maven-jetty-plugin. Both were in the file, but
seems like the first one is the one that is honored. Removed the entry for
the newer plugin artifact and then jetty:run worked like a charm with the
older version and all configurations were honored.

Thanks!


--
View this message in context: http://maven.40175.n5.nabble.com/Maven-Jetty-Plugin-won-t-honor-webAppSourceDirectory-tp4774500p4778595.html
Sent from the Maven - Users mailing list archive at Nabble.com.

Loading...