简体   繁体   English

Maven jetty插件和资源目录

[英]Maven jetty plugin and the resources directory

Should I expect files in main/resources to be on the classpath when running the maven jetty plugin? 在运行maven jetty插件时,我是否应该期望main / resources中的文件位于类路径中? Meaning will they be available to the app I'm running inside jetty? 这些应用程序可用于我在码头内运行吗? Will I be able to load them as classpath resources rather than via the file system? 我是否可以将它们作为类路径资源而不是通过文件系统加载?

The same question goes for running junit tests inside Eclipse, using the Eclipse Maven plugin. 使用Eclipse Maven插件在Eclipse中运行junit测试也是同样的问题。

If this directory is not on the classpath, can I add it? 如果此目录不在类路径上,我可以添加它吗?

The resources from src/main/resources are copied into target/classes during the process-resources phase so, yes, they will be on the class path when running the maven jetty plugin. 来自src/main/resourcesprocess-resources阶段被复制到target/classes中,因此,是的,它们将在运行maven jetty插件时位于类路径上。 They will also be available when running unit tests (actually, see this previous answer ). 它们在运行单元测试时也可用(实际上,请参见前面的答案 )。 This applies inside Eclipse and on the command line. 这适用于Eclipse内部和命令行。

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

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