CAMEL-9787: Migrate Maven Archetypes to new build system
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1783b28e Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1783b28e Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1783b28e Branch: refs/heads/master Commit: 1783b28e31a7e0841bc974d51cec3ad5d326094a Parents: 034f7b0 Author: Claus Ibsen <davscl...@apache.org> Authored: Sun Apr 3 09:39:05 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sun Apr 3 10:03:30 2016 +0200 ---------------------------------------------------------------------- .../META-INF/maven/archetype-metadata.xml | 5 +- .../main/resources/archetype-resources/pom.xml | 47 +++++++++++-------- .../OSGI-INF/blueprint/blueprint-service.xml | 38 --------------- .../test/java/BlueprintServiceRouteTest.java | 49 -------------------- 4 files changed, 31 insertions(+), 108 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/1783b28e/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml ---------------------------------------------------------------------- diff --git a/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml b/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml index ac6b834..55c6c36 100644 --- a/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml +++ b/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml @@ -34,7 +34,10 @@ <defaultValue>${maven-resources-plugin-version}</defaultValue> </requiredProperty> <requiredProperty key="maven-bundle-plugin-version"> - <defaultValue>${maven-bundle-version}</defaultValue> + <defaultValue>${maven-bundle-plugin-version}</defaultValue> + </requiredProperty> + <requiredProperty key="maven-jar-plugin-version"> + <defaultValue>${maven-jar-plugin-version}</defaultValue> </requiredProperty> <requiredProperty key="slf4j-version"> <defaultValue>${slf4j-version}</defaultValue> http://git-wip-us.apache.org/repos/asf/camel/blob/1783b28e/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml ---------------------------------------------------------------------- diff --git a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml index 15f71a3..9e9d02d 100644 --- a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml +++ b/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml @@ -21,20 +21,24 @@ <groupId>${groupId}</groupId> <artifactId>${artifactId}</artifactId> - <packaging>jar</packaging> <version>${version}</version> + <packaging>jar</packaging> <name>Camel Blueprint Route</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <camel-version>${camel-version}</camel-version> + <slf4j-version>${slf4j-version}</slf4j-version> <log4j-version>${log4j-version}</log4j-version> </properties> <dependencies> + + <!-- Camel --> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-core</artifactId> @@ -46,13 +50,6 @@ <version>\${camel-version}</version> </dependency> - <!-- Logging --> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>\${slf4j-version}</version> - </dependency> - <!-- Testing --> <dependency> <groupId>org.apache.camel</groupId> @@ -60,8 +57,6 @@ <version>\${camel-version}</version> <scope>test</scope> </dependency> - - <!-- Test Logging --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> @@ -78,9 +73,9 @@ </dependencies> <build> - <defaultGoal>install</defaultGoal> - <plugins> + + <!-- compiler plugin --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> @@ -99,18 +94,31 @@ </configuration> </plugin> - <!-- to generate the MANIFEST-FILE of the bundle --> + <!-- to generate the MANIFEST.MF of the bundle --> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>${maven-bundle-plugin-version}</version> - <extensions>true</extensions> + <extensions>false</extensions> + <executions> + <execution> + <id>bundle-manifest</id> + <phase>prepare-package</phase> + <goals> + <goal>manifest</goal> + </goals> + </execution> + </executions> + </plugin> + <!-- to include MANIFEST.MF in the bundle --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>${maven-jar-plugin-version}</version> <configuration> - <instructions> - <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> - <Private-Package>${package}.*</Private-Package> - <Import-Package>*</Import-Package> - </instructions> + <archive> + <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> + </archive> </configuration> </plugin> @@ -120,7 +128,6 @@ <artifactId>camel-maven-plugin</artifactId> <version>\${camel-version}</version> </plugin> - </plugins> </build> http://git-wip-us.apache.org/repos/asf/camel/blob/1783b28e/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint-service.xml ---------------------------------------------------------------------- diff --git a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint-service.xml b/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint-service.xml deleted file mode 100644 index aa9d94e..0000000 --- a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint-service.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -## ------------------------------------------------------------------------ -## Licensed to the Apache Software Foundation (ASF) under one or more -## contributor license agreements. See the NOTICE file distributed with -## this work for additional information regarding copyright ownership. -## The ASF licenses this file to You under the Apache License, Version 2.0 -## (the "License"); you may not use this file except in compliance with -## the License. You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -## ------------------------------------------------------------------------ -<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" - xsi:schemaLocation=" - http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd - http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd"> - - <reference id="helloService" interface="${package}.Hello" /> - - <camelContext id="blueprint-service-context" xmlns="http://camel.apache.org/schema/blueprint"> - <route id="timerToLog"> - <from uri="timer:foo?period=5000"/> - <setBody> - <method ref="helloService" method="hello"/> - </setBody> - <log message="The message contains ${body}"/> - <to uri="mock:result"/> - </route> - </camelContext> - -</blueprint> http://git-wip-us.apache.org/repos/asf/camel/blob/1783b28e/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/java/BlueprintServiceRouteTest.java ---------------------------------------------------------------------- diff --git a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/java/BlueprintServiceRouteTest.java b/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/java/BlueprintServiceRouteTest.java deleted file mode 100644 index 780cafe..0000000 --- a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/java/BlueprintServiceRouteTest.java +++ /dev/null @@ -1,49 +0,0 @@ -## ------------------------------------------------------------------------ -## Licensed to the Apache Software Foundation (ASF) under one or more -## contributor license agreements. See the NOTICE file distributed with -## this work for additional information regarding copyright ownership. -## The ASF licenses this file to You under the Apache License, Version 2.0 -## (the "License"); you may not use this file except in compliance with -## the License. You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -## ------------------------------------------------------------------------ -package ${package}; - -import java.util.Dictionary; -import java.util.Map; - -import org.apache.camel.test.blueprint.CamelBlueprintTestSupport; -import org.apache.camel.util.KeyValueHolder; - -import org.junit.Test; - -public class BlueprintServiceRouteTest extends CamelBlueprintTestSupport { - - @Override - protected String getBlueprintDescriptor() { - return "/OSGI-INF/blueprint/blueprint-service.xml"; - } - - @Override - protected void addServicesOnStartup(Map<String, KeyValueHolder<Object, Dictionary>> services) { - services.put( Hello.class.getName(), asService(new HelloBean(), null, null)); - } - - @Test - public void testRoute() throws Exception { - // the route is timer based, so every 5th second a message is send - // we should then expect at least one message - getMockEndpoint("mock:result").expectedMinimumMessageCount(1); - - // assert expectations - assertMockEndpointsSatisfied(); - } - -}