java agent maven,使用Maven exec插件指定javaagent参数

I have a similar question to: this previous question

I am converting a Java project using Netbeans to Maven. In order to launch the program, one of the command-line arguments we need is the -javaagent setting. e.g.

-javaagent:lib/eclipselink.jar

I'm trying to get Netbeans to launch the application for development use (we will write custom launch scripts for final deployment)

Since I'm using Maven to manage the Eclipselink dependencies, I may not know the exact filename of the Eclipselink jar file. It may be something like eclipselink-2.1.1.jar based on the version I have configured in the pom.xml file.

How do I configure the exec-maven-plugin to pass the exact eclipselink filename to the command line argument?

org.codehaus.mojo

exec-maven-plugin

java

-Xmx1000m

-javaagent:lib/eclipselink.jar <==== HELP?

-classpath

my.App

解决方案

I figured out a way that seems to work well.

First, setup the maven-dependency-plugin to always run the "properties" goal.

maven-dependency-plugin

2.5.1

getClasspathFilenames

properties

Later on, use the property it sets as documented here with the form:

groupId:artifactId:type:[classifier]

e.g.

-javaagent:${mygroup:eclipselink:jar}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值