NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Gary Greenberg Posted via mailing list.
|
Posted: Sun Jun 17, 2012 8:14 am Post subject: Setting properties for Maven exec-plugin |
|
|
I am working with the maven project that is being run via mojo plugin.
It also require some properties to be set for successful execution.
For the strait Run I had to create a custom goal in the project
properties for IDE to pick up these properties from the POM (see below).
I am having problems debugging this project as NB is not setting these
properties.
My peers, who are using IntelliJ are laughing and making some snide
remarks about Netbeans.
Can some Maven/NB guru help me to set up my NB project properties, so
RUN and debug would pick up whatever is specified in the POM?
I'd appreciate it greatly.
Relevant section of my POM file looks like:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>...</mainClass>
<!--<classpathScope>test</classpathScope>-->
<classpathScope>runtime</classpathScope>
<systemProperties>
<systemProperty>
<key>key1l</key>
<value>value1</value>
</systemProperty>
<systemProperty>
<key>key2</key>
<value>value2</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin> |
|
| Back to top |
|
 |
Milos Kleint Posted via mailing list.
|
Posted: Mon Jun 18, 2012 5:14 am Post subject: Setting properties for Maven exec-plugin |
|
|
for jar projects the ecec plugin is used to run, so any system props defined in pom should be used without tweaking the action configuration.
partly unrelated, in 7.2 you can now define properties along with profiles in configurations and any action triggered with the configuration active will get these properties injected.
milos
On Sunday, June 17, 2012, Gary Greenberg wrote:
| Quote: | I am working with the maven project that is being run via mojo plugin.
It also require some properties to be set for successful execution.
For the strait Run I had to create a custom goal in the project properties for IDE to pick up these properties from the POM (see below).
I am having problems debugging this project as NB is not setting these properties.
My peers, who are using IntelliJ are laughing and making some snide remarks about Netbeans.
Can some Maven/NB guru help me to set up my NB project properties, so RUN and debug would pick up whatever is specified in the POM?
I'd appreciate it greatly.
Relevant section of my POM file looks like:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>...</mainClass>
<!--<classpathScope>test</classpathScope>-->
<classpathScope>runtime</classpathScope>
<systemProperties>
<systemProperty>
<key>key1l</key>
<value>value1</value>
</systemProperty>
<systemProperty>
<key>key2</key>
<value>value2</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
|
--
Sent from Gmail Mobile |
|
| Back to top |
|
 |
Gary Greenberg Posted via mailing list.
|
Posted: Mon Jun 18, 2012 5:27 pm Post subject: Setting properties for Maven exec-plugin |
|
|
On 6/17/2012 10:13 PM, Milos Kleint wrote:
| Quote: | for jar projects the ecec plugin is used to run, so any system props
defined in pom should be used without tweaking the action configuration.
| It should but won't. One of the properties defined in my pom file is:
<systemProperty>
<key>norbert.nodeId</key>
<value>12</value>
</systemProperty>
When I start it using the custom goal my log says:
10:11:34.497 [NorbertProtobufService STARTING] INFO
c.l.norbert.network.netty.NettyNetworkServer - NetworkServer started
10:11:34.497 [NorbertProtobufService STARTING] DEBUG
c.p.core.NorbertProtobufService - Marking service 'GG.AppRuntime' as
available in Norbert as node '12'
If I use strait 'Run' I am getting
10:15:28.134 [NorbertProtobufService STARTING] INFO
c.l.norbert.network.netty.NettyNetworkServer - NetworkServer started
10:15:28.135 [NorbertProtobufService STARTING] DEBUG
c.p.core.NorbertProtobufService - Marking service 'GG.AppRuntime' as
available in Norbert as node '1'
I.e. instead of value '12' specified pom it is picking up default value '1'.
Milos, I really respect your opinion, but have you tried it and verified
that it is working yourself?
If so, how can I make it working for me?
Regards,
Gary |
|
| Back to top |
|
 |
Milos Kleint Posted via mailing list.
|
Posted: Mon Jun 18, 2012 6:32 pm Post subject: Setting properties for Maven exec-plugin |
|
|
On Mon, Jun 18, 2012 at 7:22 PM, Gary Greenberg <address-removed> wrote:
| Quote: | On 6/17/2012 10:13 PM, Milos Kleint wrote:
| Quote: |
for jar projects the ecec plugin is used to run, so any system props
defined in pom should be used without tweaking the action configuration.
| It should but won't. One of the properties defined in my pom file is:
<systemProperty>
<key>norbert.nodeId</key>
<value>12</value>
</systemProperty>
When I start it using the custom goal my log says:
10:11:34.497 [NorbertProtobufService STARTING] INFO
c.l.norbert.network.netty.NettyNetworkServer - NetworkServer started
10:11:34.497 [NorbertProtobufService STARTING] DEBUG
c.p.core.NorbertProtobufService - Marking service 'GG.AppRuntime' as
available in Norbert as node '12'
If I use strait 'Run' I am getting
10:15:28.134 [NorbertProtobufService STARTING] INFO
c.l.norbert.network.netty.NettyNetworkServer - NetworkServer started
10:15:28.135 [NorbertProtobufService STARTING] DEBUG
c.p.core.NorbertProtobufService - Marking service 'GG.AppRuntime' as
available in Norbert as node '1'
I.e. instead of value '12' specified pom it is picking up default value '1'.
Milos, I really respect your opinion, but have you tried it and verified
that it is working yourself?
|
well, no I haven't tried anything, the description is not completion
for me to even try. a sample project would speed up verification.
my wild guess is that
1. <systemProperties> are a parameter of the exec:java goal.
2. Run project by default uses exec:exec which doesn't define such
parameter (ergo it's ignored)
Milos
| Quote: | If so, how can I make it working for me?
Regards,
Gary
|
|
|
| Back to top |
|
 |
Gary Greenberg Posted via mailing list.
|
Posted: Tue Jun 19, 2012 9:44 pm Post subject: Setting properties for Maven exec-plugin |
|
|
On 6/18/2012 11:31 AM, Milos Kleint wrote:
| Quote: | well, no I haven't tried anything, the description is not completion
for me to even try. a sample project would speed up verification. my
wild guess is that 1. <systemProperties> are a parameter of the
exec:java goal. 2. Run project by default uses exec:exec which doesn't
define such parameter (ergo it's ignored) Milos
| Quote: | If so, how can I make it working for me?
Regards,
Gary
|
| Milos,
In the project properties for the 'Run project' action I see following
content in 'Execute goals' : process-classes
org.codehaus.mojo:exec-maven-plugin:1.2:exec.
If I replace :exec with :java will it work?
There are also following properties specified for the action:
exec.args=-classpath %classpath ${packageClassName}
exec.executable=java
exec.classpathScope=runtime
Do I need them? |
|
| Back to top |
|
 |
Milos Kleint Posted via mailing list.
|
Posted: Wed Jun 20, 2012 6:18 am Post subject: Setting properties for Maven exec-plugin |
|
|
On Tue, Jun 19, 2012 at 11:44 PM, Gary Greenberg <address-removed> wrote:
| Quote: | On 6/18/2012 11:31 AM, Milos Kleint wrote:
| Quote: |
well, no I haven't tried anything, the description is not completion for
me to even try. a sample project would speed up verification. my wild guess
is that 1. <systemProperties> are a parameter of the exec:java goal. 2. Run
project by default uses exec:exec which doesn't define such parameter (ergo
it's ignored) Milos
| Quote: |
If so, how can I make it working for me?
Regards,
Gary
|
| Milos,
In the project properties for the 'Run project' action I see following
content in 'Execute goals' : process-classes
org.codehaus.mojo:exec-maven-plugin:1.2:exec.
If I replace :exec with :java will it work?
|
more or less it should. It will execute inside the maven build jvm,
for debugging you will need to declare
jpda.listen=maven in action mappings instead of the usual jpda.listen=true
| Quote: | There are also following properties specified for the action:
exec.args=-classpath %classpath ${packageClassName}
exec.executable=java
exec.classpathScope=runtime
Do I need them?
|
you will most likely need a different set of properties (if you don't
specify in the pom), consult the exec:java documentation.
Milos |
|
| Back to top |
|
 |
Gary Greenberg Posted via mailing list.
|
Posted: Mon Jun 25, 2012 11:38 pm Post subject: Setting properties for Maven exec-plugin |
|
|
On 6/19/2012 11:17 PM, Milos Kleint wrote:
| Quote: | | Quote: | On Tue, Jun 19, 2012 at 11:44 PM, Gary Greenberg <address-removed> ([email]address-removed[/email]) wrote:
| Quote: | On 6/18/2012 11:31 AM, Milos Kleint wrote:
| Quote: |
well, no I haven't tried anything, the description is not completion for
me to even try. a sample project would speed up verification. my wild guess
is that 1. <systemProperties> are a parameter of the exec:java goal. 2. Run
project by default uses exec:exec which doesn't define such parameter (ergo
it's ignored) Milos
| Quote: |
If so, how can I make it working for me?
Regards,
Gary
| | Milos,
In the project properties for the 'Run project' action I see following
content in 'Execute goals' : process-classes
org.codehaus.mojo:exec-maven-plugin:1.2:exec.
If I replace :exec with :java will it work?
|
more or less it should. It will execute inside the maven build jvm,
for debugging you will need to declare
jpda.listen=maven in action mappings instead of the usual jpda.listen=true
| Quote: | There are also following properties specified for the action:
exec.args=-classpath %classpath ${packageClassName}
exec.executable=java
exec.classpathScope=runtime
Do I need them?
|
you will most likely need a different set of properties (if you don't
specify in the pom), consult the exec:java documentation.
Milos
| | Milos,
I am sorry to bug you again but I still cannot make it to work.
No, that is incorrect, 'Run' option does work when I changed the goal fro :exec to :java and removed the rest of options.
However, I can't run my application in the debugger.
I studied plugin documentation http://mojo.codehaus.org/exec-maven-plugin/java-mojo.html with the magnifying glass.
I haven't seen a single word about the debugging there.
All the args that I am specifying it passes strait to the application main method where it is trying to open the file with this name and surely failing.
Can you, please, do a bit of 'black magic' and find a solution for NB debugger to work with exec:java plugin?
BTW, I tried to replace plugin goal in the pom from exec:java to exec:exec and it won't work either.
Although I do have <mainClass> specified in the plugin configuration it complains that it has no main class and if I specify it for the 'Run' goal it still fails. My application exits with the code 1. Sorry, I did not have time to experiment with it further.
Here is how the IntelliJ run this project in the debugger (taken from the log file of my neighbor):
"C:\Program Files\Java\jdk1.6.0_20\bin\java" -agentlib:jdwp=transport=dt_shmem,address=javadebug,suspend=y,server=n -Dclassworlds.conf=C:\apache-maven-3.0.1\bin\m2.conf -Dmaven.home=C:\apache-maven-3.0.1 -Dfile.encoding=UTF-8 -classpath "C:\apache-maven-3.0.1\boot\plexus-classworlds-2.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 10.5\lib\idea_rt.jar" org.codehaus.classworlds.Launcher --no-plugin-registry --fail-fast --no-plugin-updates --strict-checksums --update-snapshots -f C:\opt\Projects\svnroot\platform\process-flow\process-flow-service\pom.xml org.codehaus.mojo:exec-maven-plugin:1.2:java -P main |
|
| Back to top |
|
 |
Milos Kleint Posted via mailing list.
|
Posted: Tue Jun 26, 2012 8:18 pm Post subject: Setting properties for Maven exec-plugin |
|
|
well, when debugging exec:java you effectively have to debug the maven
build. We have a simplified setting for it. In the Actions panel when
you have the Debug Project action selected, there will be a property
like jpda.listen=true set which makes sure we tweak the exec:exec
parameters. Changing it to jpda.listen=maven forces the IDE to tweak
the maven execution and attach debugger to it. You will have all maven
classes in your stacktraces though.
Another UI entry point is the Add> button in the Actions panel which
should be able to add the property as well.
it works with exec:java and any other execution that's done inside the
jvm of the maven build, for example also jetty:run
Milos
On Tue, Jun 26, 2012 at 1:37 AM, Gary Greenberg <address-removed> wrote:
| Quote: | On 6/19/2012 11:17 PM, Milos Kleint wrote:
On Tue, Jun 19, 2012 at 11:44 PM, Gary Greenberg <address-removed>
wrote:
On 6/18/2012 11:31 AM, Milos Kleint wrote:
well, no I haven't tried anything, the description is not completion for
me to even try. a sample project would speed up verification. my wild guess
is that 1. <systemProperties> are a parameter of the exec:java goal. 2. Run
project by default uses exec:exec which doesn't define such parameter (ergo
it's ignored) Milos
If so, how can I make it working for me?
Regards,
Gary
Milos,
In the project properties for the 'Run project' action I see following
content in 'Execute goals' : process-classes
org.codehaus.mojo:exec-maven-plugin:1.2:exec.
If I replace :exec with :java will it work?
more or less it should. It will execute inside the maven build jvm,
for debugging you will need to declare
jpda.listen=maven in action mappings instead of the usual jpda.listen=true
There are also following properties specified for the action:
exec.args=-classpath %classpath ${packageClassName}
exec.executable=java
exec.classpathScope=runtime
Do I need them?
you will most likely need a different set of properties (if you don't
specify in the pom), consult the exec:java documentation.
Milos
Milos,
I am sorry to bug you again but I still cannot make it to work.
No, that is incorrect, 'Run' option does work when I changed the goal fro
:exec to :java and removed the rest of options.
However, I can't run my application in the debugger.
I studied plugin documentation
http://mojo.codehaus.org/exec-maven-plugin/java-mojo.html with the
magnifying glass.
I haven't seen a single word about the debugging there.
All the args that I am specifying it passes strait to the application main
method where it is trying to open the file with this name and surely
failing.
Can you, please, do a bit of 'black magic' and find a solution for NB
debugger to work with exec:java plugin?
BTW, I tried to replace plugin goal in the pom from exec:java to exec:exec
and it won't work either.
Although I do have <mainClass> specified in the plugin configuration it
complains that it has no main class and if I specify it for the 'Run' goal
it still fails. My application exits with the code 1. Sorry, I did not have
time to experiment with it further.
Here is how the IntelliJ run this project in the debugger (taken from the
log file of my neighbor):
"C:\Program Files\Java\jdk1.6.0_20\bin\java"
-agentlib:jdwp=transport=dt_shmem,address=javadebug,suspend=y,server=n
-Dclassworlds.conf=C:\apache-maven-3.0.1\bin\m2.conf
-Dmaven.home=C:\apache-maven-3.0.1 -Dfile.encoding=UTF-8 -classpath
"C:\apache-maven-3.0.1\boot\plexus-classworlds-2.4.jar;C:\Program Files
(x86)\JetBrains\IntelliJ IDEA 10.5\lib\idea_rt.jar"
org.codehaus.classworlds.Launcher --no-plugin-registry --fail-fast
--no-plugin-updates --strict-checksums --update-snapshots -f
C:\opt\Projects\svnroot\platform\process-flow\process-flow-service\pom.xml
org.codehaus.mojo:exec-maven-plugin:1.2:java -P main
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|