通过 Eclipse 的 Maven 设置 vm 默认参数
我想指定-Djava.library.path=./src/main/resources的vm args,以便自动拾取dll,并且我想在maven中指定这一点,这样其他开发人员就不必手动配置eclipse 。
我在想也许 Maven Eclipse 插件可能会有所帮助,所以我可以做类似的事情
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>
<configuration>
DO MAGIC HERE ???? <<-----
</configuration>
</plugin>
,但我看不到从插件中添加 VM 参数的方法。
我已经修复了这个问题,以便通过我当前的解决方案在命令行通过 maven 运行我的测试
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<argLine>-Xmx768m -Xms128m -Djava.library.path=${basedir}/src/main/resources/</argLine>
</configuration>
</plugin>
,我必须告诉开发人员将其手动添加到 eclipse 中,这看起来不太好。
有没有人对如何解决这个问题有任何想法。
干杯,
大卫。
I want to specify vm args of -Djava.library.path=./src/main/resources so that a dll is picked up automatically, and I want to specify this in maven, so other developers don't have to manually configure eclipse.
I was thinking perhaps the the maven eclipse plugin might help, so I could do something like
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>
<configuration>
DO MAGIC HERE ???? <<-----
</configuration>
</plugin>
But I can't see a way to add VM args from within the plugin.
I have fixed this for running my tests via maven at the command line by
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<argLine>-Xmx768m -Xms128m -Djava.library.path=${basedir}/src/main/resources/</argLine>
</configuration>
</plugin>
My current solution, is that I will have to tell the developers to add this manually to eclipse which doesnt seem very good.
Has anybody got any ideas as to how to solve this.
cheers,
David.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许这应该是一个更普遍的问题:
有没有什么方法可以将 DLL 添加到 VM,而不必通过库路径指定它?
我在某处读到,将 dll 放在应用程序根目录中并在 MANIFEST.MF 中指定 DLL 及其哈希码会触发 VM 自动拾取它。但这可能是完全错误的。
Maybe this should be a more general question:
Is there any way of adding a DLL to the VM without having to specify it through the library path?
I've read somewhere that putting the dll in the application root and specifying the DLL in the MANIFEST.MF with its hashcode triggers the VM to automatically pick it up. That could be completely wrong though.
我对你的问题的解释是你的应用程序正在加载一个 DLL,并且该 DLL 位于你的项目的资源文件夹中。正确的?
如果 DLL 位于类路径中的文件夹内,则可以获取 DLL 的完整路径,并使用以下命令加载它:
这与 maven 无关。只有两个问题:
My interpretation of your problem is that your application is loading a DLL and this DLL is located in your project in the resources folder. Correct?
You can get the full path of the DLL if the DLL is inside a folder in the class path and load it using:
This is independent of maven. There are only two problems: