OSGI系列 Web-Service

本文介绍如何在OSGI环境中创建一个Web-Service应用。通过一个父项目,包含三个子模块来实现,详细讲解了每个子模块的pom.xml配置。
摘要由CSDN通过智能技术生成

一、首先创建一个父亲项目,父亲项目下面有3个儿子模块(webservice)

<?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/maven-v4_0_0.xsd">
    <!--Base -->
    <modelVersion>4.0.0</modelVersion>
    <groupId>jmust.ws</groupId>
    <artifactId>webservice</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>
    <name>Web-Service</name>
    <url>http://common.yy.com/webservice</url>
    <distributionManagement>
        <repository>
            <id>yy</id>
            <name>yy Repository</name>
            <url>http://admin:admin123@0.0.0.0:8080/nexus/content/repositories/yyRepos/</url>
            <layout>default</layout>
        </repository>
    </distributionManagement>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.3</version>
                <configuration>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <!-- 依赖关系管理 -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
                <type>jar</type>
                <scope>test</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.compendium</artifactId>
                <version>4.2.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.camel</groupId>
                <artifactId>camel-test-blueprint</artifactId>
                <version>2.14.2</version>
            </dependency>
            <dependency>
                 <groupId>org.apache.camel</groupId>
                 <artifactId>camel-core</artifactId>
                 <version>2.15.2</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <!-- 依赖 -->
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <type>jar</type>
            <scope>test</scope>
            <optional>true</optional>
        </dependency>
    </dependencies>
    <!--子模块 -->
    <modules>
        <module>ws_inter</module>
        <module>ws_impl</module>
        <module>ws_service</module>
    </modules> 

</project>

1、 第一个儿子模块(inter)

(1)pom.xml

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>jmust.ws</groupId>
        <artifactId>webservice</artifactId>
        <version>1.0.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <groupId>jmust.ws.webservice</groupId>
    <artifactId>inter</artifactId>
    <packaging>bundle</packaging>
    <version>1.0.0</version>
    <name>ws-inter</name>
    <url>http://maven.apache.org</url>
    <distributionManagement>
        <repository>
            <id>jmust</id>
            <name>jmust Repository</name>
            <url>http://admin:admin123@192.168.1.65:8081/nexus/content/repositories/JMustRepos/</url>
            <layout>default</layout>
        </repository>
    </distributionManagement>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-test-blueprint</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.12</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.10</version>
        </dependency>    
    </dependencies>
    <build>
        <plugins>
            <!-- to generate the MANIFEST-FILE of the bundle -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.5.4</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-Vendor>yy</Bundle-Vendor>
                        <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                        <Bundle-Name>${project.groupId}.${project.Artifact
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值