[英]Eclipse - “Run as Java Application” when maven is involved
I have a maven project. 我有一个maven项目。 As activeByDefault
I have the production profile. 作为activeByDefault
我有生产资料。 It seems I can't find a way to run it as application in Eclipse using the staging profile unless I put the activeByDefault
in the staging profile. 似乎我找不到使用登台配置文件在Eclipse中作为应用程序运行它的方法,除非我将activeByDefault
放在登台配置文件中。 Is there a way to configure this so I don't have to edit the pom every time? 有没有办法配置这个,所以我不必每次编辑pom?
The only thing is affected in running Java app from Maven project in Eclipse is how application classpath is constructed. 从Eclipse中的Maven项目运行Java应用程序中唯一受影响的是应用程序类路径的构造方式。 Generally in Maven there are several different classpaths scopes: compile, compile tests (this one is actually used to construct classpath in Eclipse JDT) and runtime. 通常在Maven中有几个不同的类路径范围:编译,编译测试(这个实际上用于在Eclipse JDT中构造类路径)和运行时。 The runtime classpath scope is used to assemble classpath for the application launch. 运行时类路径范围用于组合应用程序启动的类路径。 The m2e is actually using Maven code to resolve it. m2e实际上是使用Maven代码来解决它。
So, you either have to change profile activation settings in your pom.xml or specify active profile in Eclipse project properties / Maven / Active Maven Profiles. 因此,您必须更改pom.xml中的配置文件激活设置,或在Eclipse项目属性/ Maven / Active Maven配置文件中指定活动配置文件。
If you want runtime profile to be different from build-time profile in Eclipse, it is not possible right now. 如果您希望运行时配置文件与Eclipse中的构建时配置文件不同,那么现在就不可能。 You'll have to submit an enhancement request for m2e to allow to specify active profiles when calculating launch classpath. 您必须提交m2e的增强请求,以允许在计算启动类路径时指定活动的配置文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.