|
#11
|
|||
|
|||
|
I have @Configurable running with both build-time and load-time weaving. Although the LTW version has a problem with the Spring 2.0rc3 because of a bug in AspectJ 1.5.2 (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=153572).
I have just perpared a small eclipse project showing the build-time weaving in an Eclipse AJDT project. You need the same configuration in the spring context as with LTW. Code:
<aop:spring-configured/>
<bean class="com.trivadis.aop.configurable.Address" singleton="false">
<property name="codeRepository" ref="codeRepository"/>
</bean>
<bean id="codeRepository" class="com.trivadis.aop.configurable.CodeRepositoryImpl"/>
I've uploaded the sample eclipse project with this post. Just run the unit test in ConfigurableTest. Hope it helps!
__________________
Guido Schmutz Principal Consultant, Trivadis Switzerland Email: guido.schmutz AT trivadis.com |
|
#12
|
|||
|
|||
|
That worked for me. Thanks a lot!
|
|
#13
|
|||
|
|||
|
Hi!
Thank you for posting this description and code example! This made me understand how to make our unittests run from inside eclipse when built by eclipse. Until now the unittests worked just fine when running them from maven. When running them from eclipse we had to let maven do the compiling before running the tests if we had changed any of the classes using @Configurable to get dependencies injected The next step was to make maven generate correct .project og .classpass file for us and we almost do that now with the following in pom.xml:Code:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<projectnatures>
<java.lang.String>org.springframework.ide.eclipse.core.springnature</java.lang.String>
<java.lang.String>org.eclipse.jdt.core.javanature</java.lang.String>
<java.lang.String>org.eclipse.ajdt.ui.ajnature</java.lang.String>
</projectnatures>
<buildcommands>
<buildcommand>org.eclipse.ajdt.core.ajbuilder</buildcommand>
</buildcommands>
</configuration>
</plugin>
Code:
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-aspects/2.0.6/spring-aspects-2.0.6.jar">
<attributes>
<attribute name="org.eclipse.ajdt.aspectpath" value="true"/>
</attributes>
</classpathentry>
http://jira.codehaus.org/browse/MECLIPSE-270 Feel free to vote for this issue! ![]() btw are we using the following aspectj-maven-plugin configuration: Code:
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.0-beta-2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>iso-8859-1</encoding>
<verbose>true</verbose>
<outxml>false</outxml>
<showWeaveInfo>true</showWeaveInfo>
<proceedOnError>true</proceedOnError>
<weaveDependencies>
<weaveDependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</weaveDependency>
</weaveDependencies>
<aspectLibrarys>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibrarys>
</configuration>
</plugin>
-Kaj
Last edited by kajh; Sep 3rd, 2007 at 06:16 AM. |
|
#14
|
|||
|
|||
|
Here is the solution I am using to do weaving - http://anydoby.com/jblog/article.htm?id=61&lng=en
|
|
#15
|
|||
|
|||
|
Quote:
|
|
#16
|
|||
|
|||
|
Quote:
![]() I include part of our pom.xml bellow. You might try to add that and see if it helps. btw... feel free to vote for http://jira.codehaus.org/browse/MECLIPSE-270 Code:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.5.3</version>
</dependency>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.0-beta-2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>utf-8</encoding>
<verbose>true</verbose>
<outxml>false</outxml>
<showWeaveInfo>true</showWeaveInfo>
<proceedOnError>true</proceedOnError>
<weaveDependencies>
<weaveDependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</weaveDependency>
</weaveDependencies>
<aspectLibrarys>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibrarys>
</configuration>
</plugin>
|
|
#17
|
|||
|
|||
|
I have investigated the issue of aspectj plugin including 3rd party aspects into my jars and realized that the plugin does not work for me. I was able to write my own plugin
http://anydoby.com/jblog/article.htm?id=68&lng=enwhich works as I expect it to work |
![]() |
| Thread Tools | |
| Display Modes | |
|
|