Skip navigation links

NetBeans Architecture Answers for Maven Projects module

WARNING: answering questions version 1.25 rather than the current 1.29.

Interfaces table

Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
MavenProjectAPIExportedFriend

The Maven Project API provides some miscellaneous friend APIs and SPIs relating to Maven projects.

Group of layer interfaces
Interface NameIn/OutStabilitySpecified in What Document?
MavenProjectCustomizerExportedOfficial

"Projects/org-netbeans-modules-maven/Customizer" folder's content is used to construct the project's customizer. It's content is expected to be ProjectCustomizer.CompositeCategoryProvider instances. The lookup passed to the panels contains an instance of Project and org.netbeans.modules.maven.api.customizer.ModelHandle Please note that the latter is not part of any public APIs and you need friend dependency to make use of it.

MavenLogicalViewProviderExportedOfficial

"Projects/org-netbeans-modules-maven/Nodes" folder's content is used to construct the project's child nodes. It's content is expected to be NodeFactory instances.

MavenLookupExportedOfficial

"Projects/org-netbeans-modules-maven/Lookup" folder's content is used to construct the project's additional lookup. It's content is expected to be LookupProvider instances. Maven project provides LookupMergers for Sources, PrivilegedTemplates, RecommendedTemplates and other classes. Implementations added by 3rd parties will be merged into a single instance in the project's lookup.

MavenPackagingLookupExportedUnder Development

Projects/org-netbeans-modules-maven/<packaging-type>/Lookup is added to the project's additional Lookup. The content is expected to contain packaing-specific services and processors, for example, PrerequisitesCheckers. In addition, Projects/org-netbeans-modules-maven/_any/Lookup defines services that act after the packaging-specific ones.

For the details and examples, see description in PrerequisitesChecker javadoc.

PluginLookupExportedOfficial

Technology-related services can be registered so they activate in a project that has configured a specific Maven plugin. Such services should be placed in Projects/org-netbeans-modules-maven/<plugin-id>/Lookup folder. Maven core module will plug these providers in as soon as the plugin-id appears in the POM model, and will remove them from project's Lookup when the plugin is no longer part of the project's model. See NbMavenProject javadoc for details/examples.

MavenActionsExportedOfficial

"Projects/org-netbeans-modules-maven/ProjectActions", "Projects/org-netbeans-modules-maven/DependenciesActions" and "Projects/org-netbeans-modules-maven/DependencyActions" folders' content is used to add item's to node popup. To main project node, Dependencies node and node for single dependency. It's content is expected to be Action instances.

LifecycleParticipantsExportedOfficial

A module can disable warning for a custom lifecycle participant by creating a folder in Projects/org-netbeans-modules-maven/LifecycleParticipant. Currently single boolean attribute, ignoreOnModelLoad is supported, which suppresses project problem and warning about the custom participant. The participant's code does not run after project load.

MavenArchetypesExportedOfficial

"Projects/org-netbeans-modules-maven/Archetypes" folder contains fileobjects that represent archetypes. The archetypes are defined by the following file attributes:

groupIdmandatory
artifactIdmandatory
versionmandatory
repositoryoptionalurl of the archetype's repository
nameBundleKeyoptionalkey in bundle file that holds localized name
descriptionBundleKeyoptionalkey in bundle file that holds localized description

Project.org-netbeans-modules-maven.RunGoalsExportedUnder Development

A executable-like plugin goals, that may serve in place of exec:exec may be registered here. The core implementation will recognize such goals as exec's and will not disable app amd VM parameter configuration UI. For an example, see MavenActionProvider.

Group of lookup interfaces
Interface NameIn/OutStabilitySpecified in What Document?
ActionConfigurationImportedOfficial

Project API clients may place ProjectConfiguration instance in the context Lookup passed to ActionProvider.isActionEnabled() or ActionProvider.invokeAction(). If such instance is present, the action is configured according to settings in the selected configuration. If not present, the active configuration is used. See example in NbMavenProject documentation.

ExplicitProcessParametersExportedUnder Development

Project actions that execute user application (run, debug) accept additional VM and application arguments as a series of ExplicitProcessParameters instance(s) in the action's Lookup. See ExplicitProcessParameters javadoc for more details.

Group of property interfaces
Interface NameIn/OutStabilitySpecified in What Document?
netbeans.ignore.jdk.bootclasspathExportedUnder Development

The maven support recognizes special tag in maven-compiler-plugin configuration that instructs the IDE to not put JDK libraries on a classpath. One can use:
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <compilerArguments>
                <bootclasspath>netbeans.ignore.jdk.bootclasspath</bootclasspath>
            </compilerArguments>
        </configuration>
    </plugin>
          
section in pom.xml to suppress the JDK libraries.

exec.vmArgsExportedStable

The plugin exports Java VM parameters to be used for application execution in ${exec.vmArgs} property that can be used in action mappings or Maven pom.xml.

exec.appArgsExportedStable

The plugin exports application parameters to be used for application execution in ${exec.appArgs} property that can be used in action mappings or Maven pom.xml.

NbIde.ExportedPrivate

Properties designed to be read only by NB IDE code, and not passed to Maven can be prefixed by this prefix. Maven module uses such properties to communicate between services that participate on maven launch internally.

jpda.attachExportedStable

One can define following code in nbactions.xml file to start a process during goal execution and attach a debugger to it once the execution is over. Here is an example using enhancement in the Maven Android plugin:

<action>
    <actionName>debug</actionName>
    <goals>
        <goal>clean</goal>
        <goal>package</goal>
        <goal>android:deploy</goal>
        <goal>android:run</goal>
    </goals>
    <properties>
        <skipTests>true</skipTests>
        <android.run.debug>${jpda.attach.port}</android.run.debug>
        <jpda.attach>true</jpda.attach>
    </properties>
</action>

Value of jpda.attach property can either be true and in such case the IDE finds an empty port and sets values of jpda.attach.port and jpda.attach.address properties accordingly, or it can be directly specified address:port or just port number to connect to.

jpda.attach.triggerExportedStable

One can define following code in nbactions.xml file to start a process during goal execution and attach a debugger to it when the external process prints a text indicating it's ready for attaching debugger. One example is debugging applications using Multi-OS Engine:

    <action>
        <actionName>debug</actionName>
        <goals>
            <goal>package</goal>
            <goal>moe:launch</goal>
        </goals>
        <properties>
            <skipTests>true</skipTests>
            <moe.options>debug:${jpda.attach.port}</moe.options>
            <jpda.attach>true</jpda.attach>
            <jpda.attach.trigger>JDWP will wait for debugger on port</jpda.attach.trigger>
        </properties>
        <activatedProfiles>
            <activatedProfile>moe</activatedProfile>
        </activatedProfiles>
    </action>

Value of jpda.attach.trigger property is the expected text.

Group of systemproperty interfaces
Interface NameIn/OutStabilitySpecified in What Document?
org.netbeans.modules.maven.execute.AbstractOutputHandler.SLEEP_DELAYExportedUnder Development

A system property can be used to change the default indexing sleep delay during builds, in case reparsing starts too soon (wasting CPU) or too late (impeding editing).

Group of branding interfaces
Interface NameIn/OutStabilitySpecified in What Document?
org.netbeans.modules.maven.options.DEFAULT_REUSE_OUTPUTExportedUnder Development

Brand the DEFAULT_REUSE_OUTPUT key in a org.netbeans.modules.maven.options.Bundle file with one of the values true or false to specify the default behavior of reusing output by your application. Use never value, if the reuse shall never be done, regardless of the settings value.

org.netbeans.modules.maven.api.execute.DEFAULT_COMPILE_ON_SAVEExportedUnder Development

Brand the DEFAULT_COMPILE_ON_SAVE key in a org.netbeans.modules.maven.api.execute.Bundle file with one of the values all or none to specify the default behavior of compile on save in Maven projects.

org.netbeans.modules.maven.indexer.api.DEFAULT_CREATE_INDEXExportedUnder Development

Brand the DEFAULT_CREATE_INDEX key in org.netbeans.modules.maven.indexer.api.Bundle file with one of the values true or false to control (usually to disable with DEFAULT_CREATE_INDEX=false) the default behavior automatic maven index downloading.

org.netbeans.modules.maven.indexer.api.DEFAULT_UPDATE_FREQExportedUnder Development

Brand the DEFAULT_UPDATE_FREQ key in org.netbeans.modules.maven.indexer.api.Bundle file with one of the values:
  • 0 - once a week
  • 1 - once a day
  • 2 - on each startup
  • 3 - never
to control (usually to disable with DEFAULT_UPDATE_FREQ=3) the default behavior automatic maven index downloading.

Group of java.io.File interfaces
Interface NameIn/OutStabilitySpecified in What Document?
nbactions.xmlExportedStable

NetBeans Maven support recognizes special file(s) that can be placed next to a pom.xml. These files contain description of bindings between NetBeans UI actions (compile, run, debug, etc.) and the actual Maven goals to execute.

Primary name of the file is nbactions.xml. In addition to this, there can be other nbactions-profile.xml where profile is the name of a Maven profile. These files are active when such profile is choosen as a selected project configuration. The sample format of the file follows:

<?xml version="1.0" encoding="UTF-8"?>
<actions>
    <action>
        <actionName>run</actionName>
        <goals>
            <goal>process-classes</goal>
            <goal>exec:java</goal>
        </goals>
    </action>
    <action>
        <actionName>debug</actionName>
        <goals>
            <goal>process-classes</goal>
            <goal>exec:java</goal>
        </goals>
        <properties>
            <jpda.listen>maven</jpda.listen>
        </properties>
    </action>
    <action>
        <!-- this action is shown in 'Custom' submenu of project popup menu -->
        <actionName>CUSTOM-bck2brwsr-show</actionName>
        <displayName>Run in a Browser</displayName>
        <goals>
            <goal>clean</goal>
            <goal>package</goal>
            <goal>bck2brwsr:show</goal>
        </goals>
        <activatedProfiles>
            <activatedProfile>bck2brwsr</activatedProfile>
        </activatedProfiles>
        <properties>
            <skipTests>true</skipTests>
        </properties>
    </action>
    <!-- the profiles section is only useful in nbactions.xml 
        and gets activated when profile of given id is choosen in the UI
        -->
    <profiles>
        <profile>
            <id>bck2brwsr</id>
            <!-- changes meaning of run action when bck2brwsr profile
                 is selected
            -->
            <actions>
                <action>
                    <actionName>run</actionName>
                    <displayName>Run in a Browser</displayName>
                    <goals>
                        <goal>clean</goal>
                        <goal>package</goal>
                        <goal>bck2brwsr:show</goal>
                    </goals>
                    <activatedProfiles>
                        <activatedProfile>bck2brwsr</activatedProfile>
                    </activatedProfiles>
                    <properties>
                        <skipTests>true</skipTests>
                    </properties>
                </action>
            </actions>
        </profile>
    </profiles>
</actions>
             

If an action is not found in currently selected <profile> section, the system fallbacks to the main list of actions. In the previous example, the debug action would be taken from main list for all the profiles.


General Information


Project and platform dependencies


Deployment


Compatibility with environment


Access to resources


Lookup of components


Execution Environment


Format of files and protocols


Performance and Scalability