admin管理员组文章数量:1289539
I would like to use src/main/javascript as the source directory for my javascript files while still using src/main/webapp for most other web files but the maven jetty:run plugin does not know about this directory by default.
The following is as far as I've gotten so far but it does not seem to make Jetty aware of my javascript directory:
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.12</version>
<configuration>
<webAppConfig>
<contextPath>/${project.artifactId}</contextPath>
<extraClasspath>target/classes/:src/main/javascript</extraClasspath>
</webAppConfig>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<directory>src/main/javascript</directory>
</resource>
</webResources>
</configuration>
</plugin>
How do I make the maven jetty plugin aware of this addtional web directory?
I would like to use src/main/javascript as the source directory for my javascript files while still using src/main/webapp for most other web files but the maven jetty:run plugin does not know about this directory by default.
The following is as far as I've gotten so far but it does not seem to make Jetty aware of my javascript directory:
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.12</version>
<configuration>
<webAppConfig>
<contextPath>/${project.artifactId}</contextPath>
<extraClasspath>target/classes/:src/main/javascript</extraClasspath>
</webAppConfig>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<directory>src/main/javascript</directory>
</resource>
</webResources>
</configuration>
</plugin>
How do I make the maven jetty plugin aware of this addtional web directory?
Share Improve this question asked Apr 7, 2012 at 18:50 Frank FlanniganFrank Flannigan 1,3803 gold badges16 silver badges25 bronze badges 1- I wish I could give this question and answer +10 – Travis Webb Commented Aug 19, 2012 at 23:33
3 Answers
Reset to default 6Looks like this could help you:
- http://docs.codehaus/display/JETTY/Multiple+WebApp+Source+Directory
So i'd amend your configuration as follows:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.12</version>
<configuration>
<webAppConfig>
<contextPath>/${project.artifactId}</contextPath>
<!-- Javascript files are not java class files, so you can skip this
<extraClasspath>target/classes/:src/main/javascript</extraClasspath>
-->
<baseResource implementation="org.mortbay.resource.ResourceCollection">
<resourcesAsCSV>src/main/webapp,src/main/javascript</resourcesAsCSV>
</baseResource>
</webAppConfig>
</configuration>
</plugin>
Note that the ResourceCollection
class has moved in the latest version of Jetty (9.3.0.M2).
Therefore, the implementation should point at org.eclipse.jetty.util.resource
:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>9.3.0.M2</version>
<configuration>
<webAppConfig>
<baseResource implementation="org.eclipse.jetty.util.resource.ResourceCollection">
<resourcesAsCSV>src/main/webapp,src/main/javascript</resourcesAsCSV>
</baseResource>
</webAppConfig>
</configuration>
</plugin>
As of Jetty 9:
<webApp>
<contextPath>/my-app</contextPath>
<resourceBases>
<resourceBase>${project.basedir}/src/main/webapp</resourceBase>
<resourceBase>${project.basedir}/external-static</resourceBase>
</resourceBases>
</webApp>
本文标签: javascriptHow do I make the maven jetty plugin aware of an additional web directoryStack Overflow
版权声明:本文标题:javascript - How do I make the maven jetty plugin aware of an additional web directory? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741416830a2377562.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论