Main Page

From mvn-wspbuilder-plugin (inactive) Wiki
Jump to: navigation, search

Contents

Introduction

WSP-projects are not included in neither npanday nor any other maven plugin. Thats where the mvn-wspbuilder-plugin comes into play.

What does it do?

To build wsp-Files the plugin registers an ArtifactHandler of type wsp with role-hint wsp and extension wsp. Standart npanday library lifecycle also does not exactly what we need during install and deploy. That is why their lifecycle with role-hint library is overwritten. As a benefit to this the addin-launch also is added to package phase. When its launched, the addin changes the Version numbers in the feature.xml file, fires wspbuilder and registers the artifactHandler and the generated wsp-file to the mavenproject. This last step tells all the other maven plugins like install and deploy which file to handle.

Requirements/Prerequisites

The dll file has to be signed with a snk. Based on this snk there is a receiver id under which the dll is registered to the windows machine. It is important to have the right id in the feature.xml file because sharepoint will not find the right dll if not. There is a feature request to make this a parameter or to generate it but until then, dont forget to manually change the number, whenever you change the key.

The addin will fire the wspbuilder (http://wspbuilder.codeplex.com/) executable. Unfortunately this uses the cablib.dll (http://www.codeproject.com/KB/files/CABCompressExtract.aspx) which is written in c++ and contains linux-mono-unrunnable native code. this means we need a windows box to build on. If this is exchanged in future releases this project should get switched to fire the exe with mono to make it platform independent. The addin also relies on several npanday-plugins.

Goals

The only goal is wsp

Usage

Configuring Your wsp Plugin

Since the wsp-plugin executes automatically during package phase, you dont have to put executions unlike other plugins. It requires packaging to be set to library.

<project>
 <packaging>library</packaging>
 ...
 <build>
  <plugins>
   <plugin>
    <groupId>de.tarent.maven.plugins</groupId>
    <artifactId>mvn-wspbuilder-plugin</artifactId>
    <version>1.0.0</version>
    <extensions>true</extensions>
    <configuration>
     <projectPath>${basedir}</projectPath>
     <pathToFeatureXml>${basedir}\12\TEMPLATE\FEATURES\IMSneuSiteRemover\feature.xml</pathToFeatureXml>
     <pathToWspBuilder>C:\WINDOWS\system32</pathToWspBuilder>
     <targetPath>${basedir}\bin<;/targetPath>
    </configuration>
   </plugin>
    ...
  </plugins>
   ...
 </build>
  ...
</project>

To enable wspbuilder to build the wsp-file correctly, projectpath should point to a folder containing the 12hive and also a folder /bin containing the compiled .dll. To achieve that we put this into build in our pom.xml: <directory>bin</directory>.

The plugin does change the Version numbers in the feature.xml file. That is why a correct path is required here.

Project Documentation

Lifecylce

As remarked before, the npanday lifecycle "library" is overwritten. The new lifecycle looks like this:

      <phases>
         <validate>
           npanday.plugin:maven-compile-plugin:initialize,
           npanday.plugin:maven-resolver-plugin:resolve ,
           npanday.plugin:NPanday.Plugin.Settings.JavaBinding:generate-settings
         </validate>
         <generate-sources>
           npanday.plugin:maven-compile-plugin:generate-assembly-info
         </generate-sources>
         <process-sources>
           npanday.plugin:maven-compile-plugin:process-sources,
           npanday.plugin:maven-compile-plugin:process-test-sources
         </process-sources>
         <process-resources>
           npanday.plugin:maven-resgen-plugin:copy-resources,
           npanday.plugin:maven-resgen-plugin:generate,
           npanday.plugin:maven-resgen-plugin:generate-existing-resx-to-resource
         </process-resources>
         <compile>
           npanday.plugin:maven-compile-plugin:compile,
         </compile>
         <test-compile>
           npanday.plugin:maven-compile-plugin:testCompile
         </test-compile>
         <test>npanday.plugin:maven-test-plugin:test</test>
         <package>
         	de.tarent.maven.plugins:maven-wspbuilder-plugin:wsp
         </package>
          <install>
          	org.apache.maven.plugins:maven-install-plugin:install
         </install>
         <deploy>
           org.apache.maven.plugins:maven-deploy-plugin:deploy
         </deploy>
       </phases>

Diffs to standart-npanday-lifecycle only are in phase package (now we fire the plugin), install and deploy (we exchanged the npanday plugins with the usual maven plugins as these work fine).