将类路径添加到在 maven 集成测试中运行的码头 [英] Adding classpath to jetty running in maven integration-test

查看:22
本文介绍了将类路径添加到在 maven 集成测试中运行的码头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为生成 war 文件的 Maven 项目设置集成测试.(如这里所见 http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin/.)但是我的war文件需要类路径上的一堆.properties文件,我不想在war中捆绑.

I'm trying to set up integration tests for a Maven project that produces a war file. (As seen here http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin/.) However I the war file requires a bunch of .properties files on the classpath, that I don't want to bundle in the war.

有没有办法(最好通过插件配置)将文件夹添加到 jetty 使用的类路径中?

Is there a way (preferably through plugin configuration) to add a folder to the classpath used by jetty?

我在谷歌上搜索了这个并找到了 http://markmail.org/message/awtqrgxxttra3uxx 但是这个,作为据我所知,实际上根本不起作用.未找到 .properties 文件.

I Googled this and found http://markmail.org/message/awtqrgxxttra3uxx but this, as far as I can tell, does not actually work at all. The .properties files are not found.

推荐答案

这应该可以使用 webAppConfig 配置元素(以下示例取自 这个线程):

This should be possible using the webAppConfig configuration element (sample below taken from this thread):

<webAppConfig>
  <contextPath>/nportal</contextPath>
  <!-- All I want to do here is add in the /etc/jetty/classes for runtime files. For some reason I have to also add back in the /target/classes directory -->
  <extraClasspath>${basedir}/target/classes/;${basedir}/etc/jetty/classes/</extraClasspath>
</webAppConfig> 

这篇关于将类路径添加到在 maven 集成测试中运行的码头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆