A howto for CONTINUUM-2026 (Use annotations instead of plexus-maven-plugin)
From r729913, the steps seem to be:
1. Introduce src/main/resources/META-INF/spring-context.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:annotation-config />
<context:component-scan base-package="org.apache.continuum.dao"/>
</beans>
2. Modify the pom
--- continuum/trunk/continuum-store/pom.xml 2008/12/29 15:12:01 729912
+++ continuum/trunk/continuum-store/pom.xml 2008/12/29 15:12:06 729913
@@ -28,6 +28,10 @@
<name>Continuum :: Store</name>
<dependencies>
<dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-jdo2</artifactId>
</dependency>
@@ -81,17 +85,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>descriptor</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
</project>
3. Modify the code
@Repository example
--- continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/SystemConfigurationDaoImpl.java 2008/12/29 15:12:01 729912
+++ continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/SystemConfigurationDaoImpl.java 2008/12/29 15:12:06 729913
@@ -21,14 +21,15 @@
import org.apache.maven.continuum.model.system.SystemConfiguration;
import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id$
- * @plexus.component role="org.apache.continuum.dao.SystemConfigurationDao"
*/
+@Repository("systemConfigurationDao")
public class SystemConfigurationDaoImpl
extends AbstractDao
implements SystemConfigurationDao
@Service and @Resource example
--- continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/StoreUtilities.java 2008/12/29 15:12:01 729912
+++ continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/StoreUtilities.java 2008/12/29 15:12:06 729913
@@ -20,19 +20,22 @@
*/
import org.codehaus.plexus.jdo.JdoFactory;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import javax.jdo.PersistenceManagerFactory;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id$
- * @plexus.component role="org.apache.continuum.dao.StoreUtilities"
*/
+@Service("storeUtilities")
public class StoreUtilities
{
/**
* @plexus.requirement role-hint="continuum"
*/
+ @Resource(name="jdoFactory#continuum")
private JdoFactory continuumJdoFactory;
private PersistenceManagerFactory continuumPersistenceManagerFactory;
Bonus example from this revision: switching from Plexus logging to SLF4J
When do you use Repository, vs. Service, vs. Resource?
The continuum-buildagent-core pom.xml has both a 'descriptor' goal (as above) and a 'merge' goal for plexus-maven-plugin. I suppose that means it's not going to work unless the plexus stuff in whatever is getting merged is first changed to annotations. No idea what that is though.