环境:JBoss Fuse 6.2.0 + Maven 3.2.2
本实验跟上一个实验有关。
1. 学习重点
(1)如何按 feature 部署
2. 使用 Maven 构建
(1)cd get-started
(2)mkdir -p features/src/main/resources/
(3)cd features/src/main/resources/
(4)在 features/src/main/resources/ 目录下创建 get-started.xml
<?xml version="1.0" encoding="UTF-8"?>
<features name="get-started">
<feature name="get-started-basic">
<bundle>mvn:org.fusesource.example/cxf-basic/1.0-SNAPSHOT</bundle>
<bundle>mvn:org.fusesource.example/camel-basic/1.0-SNAPSHOT</bundle>
</feature>
<feature name="get-started-cxf">
<bundle>mvn:org.fusesource.example/cxf-basic/1.0-SNAPSHOT</bundle>
</feature>
</features>
(5)cd features
(6)在 features 目录下创建 pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.fusesource.example</groupId>
<artifactId>get-started</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Getting Started Feature Repository</name>
<build>
<plugins>
<!-- Attach the generated features file as an artifact,
and publish to the maven repository -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/classes/get-started.xml</file>
<type>xml</type>
<classifier>features</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
(7)在 features 目录下执行 mvn clean install
3. 部署 feature
(1)如果 cxf-basic 和 camel-basic 已经作为 bundles 发布了,需要先将它们卸载。
(2)features:addurl mvn:org.fusesource.example/get-started/1.0-SNAPSHOT/xml/features
(3)features:list
(4)features:refreshurl
(5)features:install get-started-basic
(6)在 cxf-basic 目录下执行 mvn -Ptest
(7)features:uninstall get-started-basic
参考文献:
1. Red_Hat_JBoss_Fuse-6.2-Getting_Started-en-US.pdf
本实验跟上一个实验有关。
1. 学习重点
(1)如何按 feature 部署
2. 使用 Maven 构建
(1)cd get-started
(2)mkdir -p features/src/main/resources/
(3)cd features/src/main/resources/
(4)在 features/src/main/resources/ 目录下创建 get-started.xml
<?xml version="1.0" encoding="UTF-8"?>
<features name="get-started">
<feature name="get-started-basic">
<bundle>mvn:org.fusesource.example/cxf-basic/1.0-SNAPSHOT</bundle>
<bundle>mvn:org.fusesource.example/camel-basic/1.0-SNAPSHOT</bundle>
</feature>
<feature name="get-started-cxf">
<bundle>mvn:org.fusesource.example/cxf-basic/1.0-SNAPSHOT</bundle>
</feature>
</features>
(5)cd features
(6)在 features 目录下创建 pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.fusesource.example</groupId>
<artifactId>get-started</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Getting Started Feature Repository</name>
<build>
<plugins>
<!-- Attach the generated features file as an artifact,
and publish to the maven repository -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/classes/get-started.xml</file>
<type>xml</type>
<classifier>features</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
(7)在 features 目录下执行 mvn clean install
3. 部署 feature
(1)如果 cxf-basic 和 camel-basic 已经作为 bundles 发布了,需要先将它们卸载。
(2)features:addurl mvn:org.fusesource.example/get-started/1.0-SNAPSHOT/xml/features
(3)features:list
(4)features:refreshurl
(5)features:install get-started-basic
(6)在 cxf-basic 目录下执行 mvn -Ptest
(7)features:uninstall get-started-basic
参考文献:
1. Red_Hat_JBoss_Fuse-6.2-Getting_Started-en-US.pdf
没有评论:
发表评论