maven-jetty-plugin 忽略我的类和属性
给定此配置:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.26</version>
<configuration>
<jettyConfig>${basedir}/src/main/config/jetty.xml</jettyConfig>
<jettyEnvXml>${project.build.directory}/jetty/jetty-env.xml</jettyEnvXml>
<classesDirectory>${project.build.directory}/classes</classesDirectory>
<scanIntervalSeconds>1</scanIntervalSeconds>
</configuration>
<dependencies>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.3-603.jdbc4</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
</dependencies>
</plugin>
我在 src/main/java/com.mypackage/myproperties.properties 中有一些新值 这是 src/main/java/com.mypackage/myproperties.properties 的完美副本,来自在 pom.xml 中声明为依赖项的 WAR
当我启动 mvn jetty:run 时,会发生覆盖,并且我的文件位于目标/类而不是原始目标/类,并具有预期的新值。
顺便说一句,码头继续提供原始文件,我无法真正弄清楚为什么或从哪里。
感谢您的任何提示,我花了近 8 个小时搜索和试验这个......
Bau, 维兹
given this configuration:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.26</version>
<configuration>
<jettyConfig>${basedir}/src/main/config/jetty.xml</jettyConfig>
<jettyEnvXml>${project.build.directory}/jetty/jetty-env.xml</jettyEnvXml>
<classesDirectory>${project.build.directory}/classes</classesDirectory>
<scanIntervalSeconds>1</scanIntervalSeconds>
</configuration>
<dependencies>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.3-603.jdbc4</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
</dependencies>
</plugin>
I have some new values in src/main/java/com.mypackage/myproperties.properties
which is a perfect copy of src/main/java/com.mypackage/myproperties.properties coming from a WAR declared as a dependency in the pom.xml
When I start mvn jetty:run , the overlay takes place, and my file is in target/classes instead of the original one, with the new values as expected.
BTW jetty keeps serving the original file and I can't really figure out why or from where.
Thanks for any hints, I've been spending almost 8 hours searching and experimenting on this...
Bau,
Wiz
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现 Jetty 需要一个包含所有类(和 .properties)的完整包,否则它不允许单个新文件覆盖原始文件。
I found out that Jetty wants a full package with all its classes (and .properties) otherwise it just won't allow the single new file to override the original one.
Maven 将 jetty 插件的文件缓存在本地存储库中以实现离线模式。您可以使用 设置 来找出它在哪里并删除它。
Maven caches files for the jetty plugin in a local repository for offline mode. You can use the settings to find out where this is and delete it.