Fix FELIX-2744 Add annotations to the maven-ipojo-plugin archetype
Update the archetype format
Add annotation support
Provide a HelloComponent
The generated project is 'buildable' and ready to be used.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1052506 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/plugin/src/main/resources/META-INF/archetype.xml b/ipojo/plugin/src/main/resources/META-INF/archetype.xml
deleted file mode 100644
index ed1f74c..0000000
--- a/ipojo/plugin/src/main/resources/META-INF/archetype.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<archetype>
- <id>org.apache.felix.ipojo.plugin</id>
- <sources>
- <source>src/main/java/source.txt</source>
- </sources>
- <resources>
- <resource>src/main/resources/metadata.xml</resource>
- </resources>
-</archetype>
\ No newline at end of file
diff --git a/ipojo/plugin/src/main/resources/META-INF/maven/archetype-metadata.xml b/ipojo/plugin/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..30e84a2
--- /dev/null
+++ b/ipojo/plugin/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,25 @@
+<archetype>
+ <id>maven-ipojo-plugin</id>
+ <fileSets>
+ <fileSet filtered="true" packaged="true" encoding="UTF-8">
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ <include>**/*.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory></directory>
+ <includes>
+ <include>*.properties</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+</archetype>
\ No newline at end of file
diff --git a/ipojo/plugin/src/main/resources/archetype-resources/bundle.properties b/ipojo/plugin/src/main/resources/archetype-resources/bundle.properties
new file mode 100644
index 0000000..9a167ce
--- /dev/null
+++ b/ipojo/plugin/src/main/resources/archetype-resources/bundle.properties
@@ -0,0 +1,4 @@
+# Configure the created bundle
+private.packages=${package}
+import.packages=*
+export.package=*
\ No newline at end of file
diff --git a/ipojo/plugin/src/main/resources/archetype-resources/pom.xml b/ipojo/plugin/src/main/resources/archetype-resources/pom.xml
index 0e67f98..d27c0ea 100644
--- a/ipojo/plugin/src/main/resources/archetype-resources/pom.xml
+++ b/ipojo/plugin/src/main/resources/archetype-resources/pom.xml
@@ -5,21 +5,30 @@
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
- <name>$YOUR_PROJECT_NAME</name>
+
+ <name>${artifactId}</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+ <version>1.6.0</version>
+ </dependency>
+ </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
+ <version>2.1.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Private-Package>YOUR_PRIVATE_PACKAGES</Private-Package>
- <Import-Package>*</Import-Package> <!-- YOUR_IMPORTED_PACKAGES -->
- <Export-Package>*</Export-Package> <!-- YOUR_EXPORTED_PACKAGES -->
+ <Private-Package>${private.packages}</Private-Package>
+ <Import-Package>${import.packages}</Import-Package> <!-- defined in bundle.properties -->
+ <Export-Package>${export.packages}</Export-Package> <!-- define in bundle.properties -->
</instructions>
</configuration>
</plugin>
@@ -34,6 +43,33 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <!-- Simply read properties from file -->
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>properties-maven-plugin</artifactId>
+ <version>1.0-alpha-2</version>
+ <executions>
+ <execution>
+ <phase>initialize</phase>
+ <goals>
+ <goal>read-project-properties</goal>
+ </goals>
+ <configuration>
+ <files>
+ <file>bundle.properties</file>
+ </files>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</project>
diff --git a/ipojo/plugin/src/main/resources/archetype-resources/src/main/java/HelloComponent.java b/ipojo/plugin/src/main/resources/archetype-resources/src/main/java/HelloComponent.java
new file mode 100644
index 0000000..9ee85e0
--- /dev/null
+++ b/ipojo/plugin/src/main/resources/archetype-resources/src/main/java/HelloComponent.java
@@ -0,0 +1,14 @@
+package ${package};
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Instantiate;
+
+@Component
+@Instantiate
+public class HelloComponent {
+
+ public HelloComponent() {
+ System.out.println("Hello ${artifactId}");
+ }
+
+}
diff --git a/ipojo/plugin/src/main/resources/archetype-resources/src/main/resources/metadata.xml b/ipojo/plugin/src/main/resources/archetype-resources/src/main/resources/metadata.xml
index d1a59b6..456c9e6 100644
--- a/ipojo/plugin/src/main/resources/archetype-resources/src/main/resources/metadata.xml
+++ b/ipojo/plugin/src/main/resources/archetype-resources/src/main/resources/metadata.xml
@@ -1,8 +1,16 @@
<ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/CURRENT/core.xsd"
xmlns="org.apache.felix.ipojo">
+ <!--
+ Declare your component types and instances here
+ -->
+
+ <!--
+
<component classname="$YOUR_COMPONENT_CLASS">
- <!-- Component type description -->
+
</component>
<instance component="$YOUR_COMPONENT_CLASS" />
+
+ -->
</ipojo>
\ No newline at end of file