Motivation

This Maven plug-in lets you weave the OT/J class files of a project, so that the re-written class files can be executed without the Object Teams load-time weaver.

The load-time weaver is the preferred way to run OT/J programs if available. Currently this is supported for

  • standalone Java applications (using a -javaagent)
  • Equinox bundles (aka Eclipse plug-ins)

On other platforms, you either have to integrate the load-time weaver into the existing class loading mechanism, or: use the built-time weaver to create a static set of classes ready to run with no further infrastructure.

Using the Object Teams Build-time Weaver

To enable this plug-in add the pluginGroup "org.eclipse.objectteams" to your maven settings.

For general information on compiling OT/J programs with Maven see Using the Object Teams Parent POM

Here is a typical pom that compiles OT/J sources and weaves them using the objectteams-weaver:weave goal.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

        <modelVersion>4.0.0</modelVersion>

        <parent>
                <groupId>org.eclipse.objectteams</groupId>
                <artifactId>objectteams-parent-pom</artifactId>
                <version>2.2.0</version>
        </parent>

        <artifactId>OTStopwatch_Built-Time_Weaver_Example</artifactId>
        <version>0.0.1-SNAPSHOT</version>

        <properties>
                <tycho.version>0.18.0</tycho.version>
                <otj.version>2.2.0</otj.version>        
        </properties>

        <build>
                <plugins>
                        <plugin>
                                <groupId>org.eclipse.objectteams</groupId>
                                <artifactId>objectteams-weaver-maven-plugin</artifactId>
                                <version>0.8.0-SNAPSHOT</version>
                                <executions>
                                        <execution>
                                                <goals>
                                                        <goal>weave</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>
                                        <teamClasses>
                                                <teamClass>org.eclipse.objectteams.example.stopwatch.WatchUI</teamClass>
                                                <teamClass>org.eclipse.objectteams.example.stopwatch.WatchUIAnalog</teamClass>
                                        </teamClasses>
                                </configuration>
                        </plugin>
                </plugins>
        </build>

        <repositories>
                <repository>
                        <id>ObjectTeamsRepository</id>
                        <name>Object Teams Repository</name>
                        <url>http://download.eclipse.org/objectteams/maven/3/repository</url>
                </repository>
        </repositories>

</project>

Configuration

The plugin can further be configured via a build.plugins.plugin.configuration block. The following properties can be used:

ParameterTypeDescriptionDefault
teamClasseslist of class namesqualified names of all teams to weaveno default / required
activeTeamClasseslist of class namesqualified names of teams to activate at program startno default / optional
mainClassclass namequalified name of the main classno default / required if activeTeamClasses is set
wovenClassDirectorypath (string)output directory for woven classestarget/woven-classes