This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 259028

Summary: Cannot profile projects with maven-exec-plugin in pom.xml
Product: projects Reporter: Jaroslav Tulach <jtulach>
Component: MavenAssignee: Tomas Stupka <tstupka>
Status: RESOLVED FIXED    
Severity: normal CC: sdedic, thurka, tstupka
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description Jaroslav Tulach 2016-04-27 08:49:16 UTC
I have a project which pre-configures some parameters of the JVM with maven-exec-plugin properties. When I try to profile it, it does not start at all. The reason is that profiler UI passes in -Dexec.args=... property and this property completely disables my configuration. Example from my pom.xml:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.4.0</version>
                <configuration>
                    <executable>${java.home}/bin/java</executable>
                    <arguments>
                        <arguments>${debug}</arguments>
                        <argument>-polyglot</argument>
                        <argument>-cp</argument>
                        <classpath/>
                        <argument>org.apidesign.rubyjs.Main</argument>
                    </arguments>
                </configuration>
            </plugin>

The most important part is the "-polyglot" JVM parameter - needed for [GraalVM](http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html) to enable Ruby and JavaScript.

The project is available at (GitHub)[https://github.com/jtulach/sieve/commit/8709183dd0e7ef5b0cf78644903cbcd928d2ff90].
Comment 1 Jaroslav Tulach 2016-04-27 08:53:59 UTC
Similar problem has been observed by Sváťa. The solution he currently considers is to set other properties than "exec.args" and let the plugin configuration itself compose them together. That would be similar to the debugger/maven integration.

The debugger integration reacts to property:

jpda.listen=true

and once it is provided, it starts JPDA server and sets property jpda.address to the port the server listens to. As a result it is possible to have following in nbactions.xml:

        <action>
            <actionName>debug</actionName>
            <packagings>
                <packaging>jar</packaging>
            </packagings>
            <goals>
                <goal>process-classes</goal>
                <goal>exec:exec</goal>
            </goals>
            <properties>
                <debug>-Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}</debug>
                <jpda.listen>true</jpda.listen>
            </properties>
        </action>
Comment 2 Tomas Stupka 2016-04-27 12:31:59 UTC
to reproduce:
- graal has to be installed and setup in the IDE (http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html)
- https://github.com/jtulach/sieve  (#8709183dd0e7ef5b0cf78644903cbcd928d2ff90)
- open project "ruby+js/fromjava"
- profile ...
Comment 3 Jaroslav Tulach 2016-04-29 12:19:52 UTC
Tomáš mentioned that the Maven support could understand the exec-maven-plugin and its configuration and when preparing the command line, merge the arguments from the pom.xml with the arguments provided by tools like profiler or javarepl.

If that was done, it would be perfect.
Comment 4 Tomas Stupka 2016-05-04 09:59:05 UTC
merging the exec args as given by pom might become tricky in non trivial cases. 
so will do the merge only for cases when the nb action  doesn't derive much from the (hopefully) typical scenario as reported by jarda. 
That should resolve the problem in profiler and also avoid the additional configuration steps in nbactions.xml and pom.xml which were necessary to get debug and run working.

the solution via a dedicated property/-ies as suggested above would by more powerful and probably cover all possible cases, though not so trivial to set up and a clean implementation would ask also for changes in the already existing debugger-maven interaction. Lets keep this option open for the time when the need really appears.
Comment 5 Tomas Stupka 2016-05-04 10:01:09 UTC
fixed in jet-main #f0bb222fc8d9
Comment 6 Quality Engineering 2016-05-07 01:59:03 UTC
Integrated into 'main-silver', will be available in build *201605070002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f0bb222fc8d9
User: Tomas Stupka <tstupka@netbeans.org>
Log: Issue #259028 - Cannot profile projects with maven-exec-plugin in pom.xml