Difference between revisions of "OpenOffice Maven2 Integration"
Cedricbosdo (talk | contribs) (→Features: Described the existing and some future features) |
Cedricbosdo (talk | contribs) m (→Getting started: added sources link) |
||
Line 88: | Line 88: | ||
== Getting started == | == Getting started == | ||
− | + | The sources are located on the API project CVS: http://api.openoffice.org/source/browse/api/maven2integration/ | |
+ | |||
+ | ''Explain how to get started with the development and how to use the plugin.'' | ||
[[Category:API]] | [[Category:API]] | ||
[[Category:Effort]] | [[Category:Effort]] |
Revision as of 07:35, 10 October 2007
Overview
Maven is a well-know build framework for Java applications provided by the Apache foundation. It can be extended using plugins to perform custom actions. Maven manages the project dependencies which are fetched from remote or local repositories.
Some steps are missing in the Maven build to create and build OpenOffice.org extensions:
- Generate Java classes from IDL files
- Generate an OXT file to package the project
- Create a simple OpenOffice.org extension project structure
Features
A Maven 2 plugin for OpenOffice.org extensions is currently under development. It already provides:
- A goal to generate the Java classes from the IDL files
- An archetytpe for the structure of an OpenOffice.org Extension project
Generating an Extension project
This will be done, by using a maven archetype for Uno projects. Here are the parameters to pass to maven execution to create an test-uno project.
[bash]
mvn archetype:create \
-DgroupId=org.openoffice.dev.tests \
-DartifactId=ooo-ext-test \
-Dversion=1.0 \
-DpackageName=org.openoffice.dev \
-DarchetypeGroupId=org.openoffice.dev \
-DarchetypeArtifactId=maven-ooo-plugin \
-DarchetypeVersion=1.0
The started project will create the file and folder structure to place IDL folders and the Java sources. It will also add a generic UNO registration class like the one described by this blog post. The generated project pom.xml will contain dependencies to the OOo libraries and the needed basic configuration to run the goals provided by this maven2 plugin.
The generated project will be structured in order to fit the UNO extension packaging needs. This is not yet fully determined, but will need to be studied.
Building the IDL files
To build the IDL files, some additional configuration will be needed in the project pom.xml. The configuration will be like the following:
[xml]
<build>
<plugins>
<plugin>
<groupId>org.openoffice.dev</groupId>
<artifactId>maven-ooo-plugin</artifactId>
<version>1.0</version>
<configuration>
<ooo>/path/to/an/ooo/installation</ooo>
<sdk>/path/to/an/ooo/sdk/installation</sdk>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>build-idl</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
This Mojo configuration is not really clean, because it needs to define the path to an OpenOffice.org installation and the to OOo SDK. A solution would be to provide a default guess for the OOo installation path. There are some tools to do it for windows, but what about other OS ? What about the SDK path configuration ?
Using this configuration the Java classes corresponding to the UNO types defined in the IDL files, are generated before the Java compilation phase. Using the standard maven build command is enough:
[bash]
mvn build
Creating a new UNO type implementation
This feature is not yet developed
Creating a new UNO type implementation is quite hard. The maven plugin will provide a goal to create a skeleton for the implementation of a UNO type, either of the extension project or an OpenOffice.org one. This goal will delegate the skeleton creation to the uno-skeletonmaker tool.
It could be invoked in the following way:
[bash]
mvn ooo:skeleton \
-Dtype=the.type.to.implement \
-DimplementationName=the.class.name \
-Djava.version=1.4
The java.version parameter would be optional and could be set to 1.4 or 1.5 to indicate which version of Java the implementation will support.
This Mojo will run the uno-skeletonmaker and add the new implementation to the implementations list of the project.
Getting started
The sources are located on the API project CVS: http://api.openoffice.org/source/browse/api/maven2integration/
Explain how to get started with the development and how to use the plugin.