ActionGoalMapping

How to map the user's action like Run project/Rebuild project/Run single test to maven goals in a manner that is flexible enough and simple at the same time?

  • Use a structure generated by modello. Easy xml reading/writing..
  • Have global default settings for different packaging types (eg. war has different implementation of "run" than a jar packaged project)
  • Each project can override the defaults for all or some actions.
    • Should not be part of pom
    • Should be shareable probably, the settings can be commited to cvs/svn (have 2 levels? shareable and non shareable? too bad the project.properties and build.properties concept is gone in m2)
  • The action name matches those introduced by netbeans APIs
  • some netbeans specific value replacements will take place. We need to pass the selected files to maven when running, for single test run etc.
    • ${packageClassName} selected class's name with package name as well, eg. org.milos.kleint.MymainClass
    • ${classNameWithExtension} selected class's name with extension, eg. MymainClass.java
    • ${className} only the name of the selected class, eg. MymainClass
    • ${webpagePath} relative path of the selected file within the src/main/webapp
  • Possible configuration include
    • list of goals to run.
    • plugin configurations that's not possible to do with the current version of the embedder (jvanzyl's refactor-embedder branch). The whole idea is questionable anyway, not sure how to deal with conflicts for example. A better approach is to put the plugin configurations into a profile and let the action just influence the profile's settings by setting the right property
    • properties (would be like props on command line I suppose)
    • activated profiles?

Example xml:
here we want to map maven goals to the "debug single file" for war projects. The netbeans-deploy-plugin and netbeans-debugger-plugin can only run within the NetbeansIDE and call netbeans APIs for deployment and debugging.

<action>
        <actionName>debug.single</actionName>
        <packagings>
            <packaging>war</packaging>
        </packagings>
        <goals>
            <goal>package</goal>
            <goal>org.codehaus.mevenide:netbeans-deploy-plugin:LATEST:deploy</goal>
            <goal>org.codehaus.mevenide:netbeans-debugger-plugin:LATEST:jpdaconnect</goal>
        </goals>
        <properties>
             <netbeans.clientUrlPart>${webpagePath}</netbeans.clientUrlPart>
        </properties>
    </action>

The important part in the example is the value of the property netbeans.clientUrlPart. The property is the default that the deploy-plugin evaluates when resolving it's parameter. So by setting it here to the value of ${webpagePath}, we tell the IDE to replace the value of the property to the currently selected node under "Web Pages". It will get replaced to "/admin/login.jsp" for example and passed to maven in that property. Then it's picked up by the netbeans-deploy-plugin during the build.

Action name Has defaults for packaging Notes
build All "install" is the default lifecycle phase
clean All
rebuild All "install" is the default lifecycle phase
compile.single No Not a real equivalent in Maven2, but possible to define for your project if you have a goal to run.
run For jar,war TBD
run.single For jar,war TBD When a class from test packages is selected, test.single is actually used.
test All
test.single All
debug For jar only TBD
debug.single For jar only TBD
debug.test.single ? TBD
debug.stepinto ? TBD This one means to start the app in debug mode and stop right at the beginning..
javadoc All

Labels

 
(None)