12.07.2015 Views

Download - NetBeans

Download - NetBeans

Download - NetBeans

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>NetBeans</strong> Platform Development with Maven 2The reason is that no default Maven pluginknows how to handle the nbm packaging.We need to add the nbm-maven-plugin(which I’ll call “NBM Plugin” from now on)inside the element in the POM.See Listing 1.Now the project will build successfully.After the build, switch to the Files tab andyou’ll notice in the target folder all the extraartifacts, including the generated NBMfile (see Figure 5). At this point we havea working module project; by clicking Runyou’ll get a new IDE running, which shouldinclude our module among many others.CYou might get errors related to Windows pathswhile trying to run the project. Make sure you don’thave spaces in these paths, as these are usuallythe culprits.A 4tion class. It also changes the layer file and adds thecorresponding dependency to the POM.At this point, any build using Platform APIs will fail,as the Maven project doesn’t have a dependency onthe needed Platform-specific artifacts. First we needto declare the repository where the <strong>NetBeans</strong> artifactsare located; see Listing 2. Next we include adependency on org-openide-util, which is the moduleproviding the Platform’s Actions API. See Listing 3.This is equivalent to a dependency added to a normalPlatform module. The NBM Plugin will detect that this artifactis a module and configure the proper dependency in the generatedbuild artifact. As before, the project won’t initially compilewithout the dependency; this will be resolved when the files aredownloaded on the first build.CRegarding Listing 3, if the version RELEASE60 doesn’t work for you, tryRELEASE60-BETA2 as the new bits might not yet have reached the Mavenrepository when you read this.BListing 1. Build configuration for the NBM Plugin...org.codehaus.mojonbm-maven-pluginRELEASEtrue...AFigure 4.New Maven project,with errors that willbe solved with thefirst buildAdding an ActionWe will now create a newPlatform Action using theNew Action wizard. Thepurpose of this Action willbe just to inspect that agiven service exists andshow a dialog. The wizardautomatically generatesthe Bundle.properties filein the proper Maven-friendlyfolder, as well as the Ac-BListing 2. Declaring a default repository for <strong>NetBeans</strong> artifacts...netbeansRepository for hosting <strong>NetBeans</strong> API artifactshttp://deadlock.netbeans.org/maven2/truefalseIssue 4 N 41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!