简体   繁体   English

如何使用m2e-wtp将生成的资源部署到tomcat?

[英]How to deploy generated resources to tomcat with m2e-wtp?

I am pulling JavaScript from a jar as part of my build process. 作为构建过程的一部分,我从jar中提取JavaScript。 I wish this js to be part of my web resources for the app deployed on tomcat and I have updated my build process to allow this to happen. 我希望这个js成为我在tomcat上部署的应用程序的Web资源的一部分,并且我已经更新了我的构建过程以允许这种情况发生。 Doing a maven build (outside eclipse) works as expected and I can package up a war with everything in its proper order. 做一个maven构建(在eclipse之外)按预期工作,我可以按照正确的顺序打包一切。

However, when building with eclipse I have run into some headaches. 然而,当使用eclipse进行构建时,我遇到了一些麻烦。 My understanding was in order to have web resources deployed to tomcat through an incremental build, I needed to put these build-time generated js files into the target/m2e-wtp/web-resources directory. 我的理解是为了通过增量构建将Web资源部署到tomcat,我需要将这些构建时生成的js文件放入target / m2e-wtp / web-resources目录中。 However, when I publish these new files are ignored and the web-resources deployed to tomcat seem to be pulled from my source. 但是,当我发布这些新文件时会被忽略,并且部署到tomcat的web资源似乎是从我的源中提取的。

I also adjusted my project's deployment assembly settings. 我还调整了项目的部署程序集设置。 Through this I still don't have it working. 通过这个,我仍然没有它的工作。 I have the entry [source:/target/m2e-wtp/web-resources, DeployPath:/] which should find the newly generated files when I perform a "publish" to the server. 我有条目[source:/ target / m2e-wtp / web-resources,DeployPath:/],当我对服务器执行“发布”时,它应该找到新生成的文件。 However, the same thing happens where m2e-wtp seems to be pulling from source. 然而,同样的事情发生在m2e-wtp似乎从源头拉出来的地方。

Am I missing something? 我错过了什么吗? How can I get standard behavior from m2e-wtp (ie make it comparable to a build done outside of eclipse)? 如何从m2e-wtp获得标准行为(即使其与在eclipse之外完成的构建相当)? Or can I have eclipse just build the war and deploy it as such (not do the incremental builds, I can sacrifice some speed)? 或者我可以使用eclipse来构建战争并将其部署(不是增量构建,我可以牺牲一些速度)?

FYI (versions): 仅供参考(版本):

eclipse: (Using Spring Tool Suite) 3.2.0
m2e: 1.3.1
m2e-wtp: 0.17.0
tomcat: 7.0

Experiment added later: 实验后来添加:

After deleting my target dir, I performed a publish to Tomcat and all the web-resources were copied from my source. 删除目标目录后,我对Tomcat执行了发布,并从我的源代码中复制了所有Web资源。 I also got a popup about files not found, most of which are compiled classes. 我还有一个关于未找到的文件的弹出窗口,其中大部分是编译类。 However, it was looking for three files in the /target/m2e-wtp/web-resources/META-INF. 但是,它正在/ target / m2e-wtp / web-resources / META-INF中查找三个文件。 Does the m2e-wtp plugin only look for specific files in a folder rather than the entire specified folder? m2e-wtp插件是否只查找文件夹中的特定文件而不是整个指定的文件夹?

The problem is that the target directory was not being refreshed. 问题是目标目录没有刷新。 Eclipse (or m2e plugin for that matter) doesn't recognize or care that files change in the target directory during a build, something that I was assuming. Eclipse(或m2e插件)在构建期间无法识别或关注目标目录中的文件更改,这是我假设的。 For now I have the auto-refresh (for the workspace) option on. 现在我有自动刷新(用于工作区)选项。 The refresh on access option didn't working as it seemed to trigger the refresh only when I was publishing to tomcat for the first time. 访问刷新选项不起作用,因为它似乎只在我第一次发布到tomcat时触发刷新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM