Custom Maven Goal Definition
- In Netbeans open the options dialog in Tools - Options.
- Go to the Miscellaneous category and select the Maven tab.
- Open the Global Custom Goal Definitions dialog.
- Click Add... to add a new goal definition. Enter a custom name (e.g. "install sling") for the goal in the dialog that open and confirm with Ok.
- Select the action just created (install sling in this example) and in the Execute Goals text field enter: "install org.apache.sling:maven-sling-plugin:install ".
- in Set Properties enter (adapt the url property to the host and port of the instance you want to deploy the bundle on):
- sling.user=admin
- sling.password=admin
- sling.bundle.start=true
- sling.bundle.startlevel=3
- sling.url=http://localhost:8080/system/console/install
- Confirm with Ok.

Using the Custom Maven Goal to Deploy a Bundle
To build and then automatically deploy a bundle from Netbeans, use the custom goal defined earlier. It can be triggered by right-clicking on the project in Netbeans, then choosing Custom - install sling. "install sling" may differ depending on how the action has been named before. If the bundle has not been installed before, the run-level may need to be changed. this can be done in the felix shell with the command bundlelevel <level> <bundleid> (e.g. bundlelevel 3 146). Use bundlelevel 3 for custom bundles.

Labels
(None)