maven - Eclipse run configuration with complete package name of selected resource as variable -
i running maven project eclipse , want setup run configuration goals compile exec:java
, needs exec.mainclass
parameter. because have different main classes in project, class , package name selected resource used when running. correct run variable insert value parameter?
i use following configuration run main method of selected class. know asked parameters i'll provide more detailed steps other visitors since didn't found solution on net.
prerequisite: m2e eclipse plugin, exec-maven-plugin
- select run > maven build …
- use goal
exec:java
- optional: provide profile name
- optional: select debug output
- click add … create parameter
- name:
exec.mainclass
- value:
${java_type_name}
(this provides selected resource's full java name)
- name:
now whenever use run configuration take current class parameter , execute main method. ${java_type_name}
variable provided eclipse, should work somehow without using m2e.
one thing mention exec.mainclass
parameter didn't work me when provided goal , default configuration in pom.xml. not sure if it's bug, did wrong, or not possible. had remove goals , include plugin without configuring in build make work:
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.2.1</version> </plugin>
Comments
Post a Comment