Discussion:
[tycho-user] AspectJ weaving with org.eclipse.equinox.weaving.hook and frameworkextension
Markus Alexander Kuppe
2011-05-18 11:49:50 UTC
Permalink
Hi,

how does one set up Equinox AspectJ weaving for maven-osgi-test-plugin?
There is little documentation on the web for how EclEmma can be
integrated via the frameworkextension directive, but it requires a maven
repo to host the hook jar. Is it possible to avoid a custom repo and use
the hook bundle materialized by Tycho?

E.g. like:

<frameworkExtensions>
<frameworkExtension>
<groupId>p2.osgi.bundle</groupId>
<artifactId>org.eclipse.equinox.weaving.hook</artifactId>
<version>0.0.0</version>
</frameworkExtension>
</frameworkExtensions>

Thanks
Markus
iulian dragos
2011-06-24 15:00:49 UTC
Permalink
Have you solved it? I am trying to achieve the same thing, but weaving
doesn't happen in my tests..

thanks,
iulian

On Wed, May 18, 2011 at 1:49 PM, Markus Alexander Kuppe <
Post by Markus Alexander Kuppe
Hi,
how does one set up Equinox AspectJ weaving for maven-osgi-test-plugin?
There is little documentation on the web for how EclEmma can be
integrated via the frameworkextension directive, but it requires a maven
repo to host the hook jar. Is it possible to avoid a custom repo and use
the hook bundle materialized by Tycho?
<frameworkExtensions>
<frameworkExtension>
<groupId>p2.osgi.bundle</groupId>
<artifactId>org.eclipse.equinox.weaving.hook</artifactId>
<version>0.0.0</version>
</frameworkExtension>
</frameworkExtensions>
Thanks
Markus
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
Markus Alexander Kuppe
2011-06-27 07:57:49 UTC
Permalink
Post by iulian dragos
Have you solved it? I am trying to achieve the same thing, but weaving
doesn't happen in my tests..
Post by iulian dragos
thanks,
iulian
Hi iulian,

I ended up having tycho resolve the weaving hook with p2 into the local
Maven repository to install it in a pre-integration-test step manually.
Afterwards it can be referenced like a regular maven dependency.
Only downside is, that you depend on a specific version that might
change over time.

Markus

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>it-preparation</id>
<phase>pre-integration-test</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>

<file>${settings.localRepository}/p2/osgi/bundle/org.eclipse.equinox.weaving.hook/1.0.0.v20100503/org.eclipse.equinox.weaving.hook-1.0.0.v20100503.jar</file>
<groupId>yourcustomFoobarGroupID</groupId>
<artifactId>org.eclipse.equinox.weaving.hook</artifactId>
<version>1.0.0.v20100503</version>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>

....

<!-- Enable JDT weaving -->
<frameworkExtensions>
<frameworkExtension>
<groupId>tlatoolbox</groupId>
<artifactId>org.eclipse.equinox.weaving.hook</artifactId>
<version>1.0.0.v20100503</version>
</frameworkExtension>
</frameworkExtensions>
iulian dragos
2011-06-29 12:55:59 UTC
Permalink
On Mon, Jun 27, 2011 at 9:57 AM, Markus Alexander Kuppe <
Post by iulian dragos
Post by iulian dragos
Have you solved it? I am trying to achieve the same thing, but weaving
doesn't happen in my tests..
Post by iulian dragos
thanks,
iulian
Hi iulian,
I ended up having tycho resolve the weaving hook with p2 into the local
Maven repository to install it in a pre-integration-test step manually.
Afterwards it can be referenced like a regular maven dependency.
Only downside is, that you depend on a specific version that might
change over time.
Hi Markus,

Thank you for your message. Unfortunately, it doesn't seem to work for me. I
do get the info message:

[org.eclipse.equinox.weaving.hook] info adding AspectJ hooks ...

but nothing else. In a normal run (using the Eclipse launcher), I get a lot
more, along these lines:

[org.eclipse.equinox.weaving.hook] info adding AspectJ hooks ...
[org.eclipse.equinox.weaving.aspectj] info Starting AspectJ weaving service
...
[org.scala-ide.sdt.aspects] info AspectJ Weaver Version 1.6.11.RC1 built on
Friday Mar 4, 2011 at 20:53:44 GMT
[org.scala-ide.sdt.aspects] info register aspect
org.eclipse.jdt.core.dom.ASTConverterAspect
[org.scala-ide.sdt.aspects] info register aspect
scala.tools.eclipse.contribution.weaving.jdt.builderoptions.ScalaJavaBuilderAspect
[org.scala-ide.sdt.aspects] info register aspect
scala.tools.eclipse.contribution.weaving.jdt.cfprovider.ClassFileProviderAspect
[org.scala-ide.sdt.aspects] info register aspect
scala.tools.eclipse.contribution.weaving.jdt.core.BindingKeyAspect

Here's my pom.xml:


<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.scala-ide</groupId>
<artifactId>scala-ide-for-eclipse</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../org.scala-ide.build/pom.xml</relativePath>
</parent>
<artifactId>org.scala-ide.sdt.core.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>

<profiles>
<profile>
<id>Mac OS</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<properties>
<tycho.test.OSspecific>-Dosgi.ws=cocoa -XstartOnFirstThread
</tycho.test.OSspecific>
</properties>
</profile>

<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<tycho.test.OSspecific></tycho.test.OSspecific>
</properties>
</profile>

</profiles>

<properties>
<tycho.test.jvmArgs>-Xmx800m -XX:MaxPermSize=256m -Dsdtcore.headless
${tycho.test.OSspecific}</tycho.test.jvmArgs>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
</dependency>
</dependencies>

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>it-preparation</id>
<phase>pre-integration-test</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>


<file>${settings.localRepository}/p2/osgi/bundle/org.eclipse.equinox.weaving.hook/1.0.0.v20100503/org.eclipse.equinox.weaving.hook-1.0.0.v20100503.jar
</file>
<groupId>org.scala-ide</groupId>
<artifactId>org.eclipse.equinox.weaving.hook</artifactId>
<version>1.0.0.v20100503</version>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.0</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmArgs>
<jvmArg>-Xms512m</jvmArg>
<jvmArg>-Xmx1024m</jvmArg>
</jvmArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.tycho</groupId>
<artifactId>maven-osgi-test-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<useUIHarness>false</useUIHarness>
<useUIThread>false</useUIThread>

<!-- Enable JDT weaving -->
<systemProperties combine.children="append">
<aj.weaving.verbose>true</aj.weaving.verbose>
<org.aspectj.weaver.showWeaveInfo>true
</org.aspectj.weaver.showWeaveInfo>
<org.aspectj.osgi.verbose>true</org.aspectj.osgi.verbose>
</systemProperties>
<frameworkExtensions>
<frameworkExtension>
<groupId>org.scala-ide</groupId>
<artifactId>org.eclipse.equinox.weaving.hook</artifactId>
<version>1.0.0.v20100503</version>
</frameworkExtension>
</frameworkExtensions>

<!-- <includes> -->
<!-- <include>scala/tools/eclipse/*Test.class</include> -->
<!-- </includes> -->
<argLine>${tycho.test.jvmArgs}</argLine>
<testSuite>${project.artifactId}</testSuite>
<testClass>scala.tools.eclipse.TestsSuite</testClass>
</configuration>
</plugin>

<plugin>
<groupId>org.sonatype.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
</configuration>
</plugin>

</plugins>
</build>
</project>
Post by iulian dragos
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
iulian dragos
2011-07-05 09:04:44 UTC
Permalink
I finally managed to get this working after talking to Andew Eisenberg from
the AJDT project. I post his solution here for future reference (it took me
several weeks and a lot of frustration). I wonder if there is somewhere a
reference of all Tycho options...

<frameworkExtensions>
<frameworkExtension>
<groupId>p2.osgi.bundle</groupId>
<artifactId>org.eclipse.equinox.weaving.hook</artifactId>
<version>1.0.0.v20100503</version>
</frameworkExtension>
</frameworkExtensions>
<bundleStartLevel>
<bundle>
<id>org.eclipse.equinox.weaving.aspectj</id>
<level>2</level>
<autoStart>true</autoStart>
</bundle>
</bundleStartLevel>

In short, you need both the framework extension, and make sure that the
aspectj plugin is started automatically (you also need to have a dependency
towards it in one of your MANIFEST.MF files).

cheers,
iulian
Post by iulian dragos
On Mon, Jun 27, 2011 at 9:57 AM, Markus Alexander Kuppe <
Post by iulian dragos
Post by iulian dragos
Have you solved it? I am trying to achieve the same thing, but weaving
doesn't happen in my tests..
Post by iulian dragos
thanks,
iulian
Hi iulian,
I ended up having tycho resolve the weaving hook with p2 into the local
Maven repository to install it in a pre-integration-test step manually.
Afterwards it can be referenced like a regular maven dependency.
Only downside is, that you depend on a specific version that might
change over time.
Hi Markus,
Thank you for your message. Unfortunately, it doesn't seem to work for me.
[org.eclipse.equinox.weaving.hook] info adding AspectJ hooks ...
but nothing else. In a normal run (using the Eclipse launcher), I get a lot
[org.eclipse.equinox.weaving.hook] info adding AspectJ hooks ...
[org.eclipse.equinox.weaving.aspectj] info Starting AspectJ weaving service
...
[org.scala-ide.sdt.aspects] info AspectJ Weaver Version 1.6.11.RC1 built on
Friday Mar 4, 2011 at 20:53:44 GMT
[org.scala-ide.sdt.aspects] info register aspect
org.eclipse.jdt.core.dom.ASTConverterAspect
[org.scala-ide.sdt.aspects] info register aspect
scala.tools.eclipse.contribution.weaving.jdt.builderoptions.ScalaJavaBuilderAspect
[org.scala-ide.sdt.aspects] info register aspect
scala.tools.eclipse.contribution.weaving.jdt.cfprovider.ClassFileProviderAspect
[org.scala-ide.sdt.aspects] info register aspect
scala.tools.eclipse.contribution.weaving.jdt.core.BindingKeyAspect
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.scala-ide</groupId>
<artifactId>scala-ide-for-eclipse</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../org.scala-ide.build/pom.xml</relativePath>
</parent>
<artifactId>org.scala-ide.sdt.core.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
<profiles>
<profile>
<id>Mac OS</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<properties>
<tycho.test.OSspecific>-Dosgi.ws=cocoa -XstartOnFirstThread
</tycho.test.OSspecific>
</properties>
</profile>
<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<tycho.test.OSspecific></tycho.test.OSspecific>
</properties>
</profile>
</profiles>
<properties>
<tycho.test.jvmArgs>-Xmx800m -XX:MaxPermSize=256m -Dsdtcore.headless
${tycho.test.OSspecific}</tycho.test.jvmArgs>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>it-preparation</id>
<phase>pre-integration-test</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${settings.localRepository}/p2/osgi/bundle/org.eclipse.equinox.weaving.hook/1.0.0.v20100503/org.eclipse.equinox.weaving.hook-1.0.0.v20100503.jar
</file>
<groupId>org.scala-ide</groupId>
<artifactId>org.eclipse.equinox.weaving.hook</artifactId>
<version>1.0.0.v20100503</version>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.0</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmArgs>
<jvmArg>-Xms512m</jvmArg>
<jvmArg>-Xmx1024m</jvmArg>
</jvmArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.tycho</groupId>
<artifactId>maven-osgi-test-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<useUIHarness>false</useUIHarness>
<useUIThread>false</useUIThread>
<!-- Enable JDT weaving -->
<systemProperties combine.children="append">
<aj.weaving.verbose>true</aj.weaving.verbose>
<org.aspectj.weaver.showWeaveInfo>true
</org.aspectj.weaver.showWeaveInfo>
<org.aspectj.osgi.verbose>true</org.aspectj.osgi.verbose>
</systemProperties>
<frameworkExtensions>
<frameworkExtension>
<groupId>org.scala-ide</groupId>
<artifactId>org.eclipse.equinox.weaving.hook</artifactId>
<version>1.0.0.v20100503</version>
</frameworkExtension>
</frameworkExtensions>
<!-- <includes> -->
<!-- <include>scala/tools/eclipse/*Test.class</include> -->
<!-- </includes> -->
<argLine>${tycho.test.jvmArgs}</argLine>
<testSuite>${project.artifactId}</testSuite>
<testClass>scala.tools.eclipse.TestsSuite</testClass>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>
Post by iulian dragos
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
Markus Alexander Kuppe
2011-07-05 09:13:25 UTC
Permalink
Post by iulian dragos
<bundleStartLevel>
<bundle>
<id>org.eclipse.equinox.weaving.aspectj</id>
<level>2</level>
<autoStart>true</autoStart>
</bundle>
</bundleStartLevel>
In short, you need both the framework extension, and make sure that the
aspectj plugin is started automatically
And o.e.e.weaving.aspectj has to be started on a run level < default.

Markus

Loading...