Apache Karaf如何部署web应用程序



我有一个打包为war的web应用程序。我的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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.bedas.ays</groupId>
    <artifactId>ays</artifactId>
    <packaging>war</packaging>
    <version>v.1</version>
    <name>ays</name>
        <profile>
            <id>metadata</id>
            <build>
                <defaultGoal>generate-sources</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>com.jaxio.celerio</groupId>
                        <artifactId>maven-dbmetadata-plugin</artifactId>
                        <version>${maven-celerio-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>Extract the database schema.</id>
                                <goals>
                                    <goal>extract-metadata</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>${jdbc.groupId}</groupId>
                                <artifactId>${jdbc.artifactId}</artifactId>
                                <version>${jdbc.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
            <repositories>
                <repository>
                    <id>springfuse-repository</id>
                    <url>http://maven2.springfuse.com/</url>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>springfuse-repository</id>
                    <url>http://maven2.springfuse.com/</url>
                </pluginRepository>
            </pluginRepositories>
        </profile>
        <profile>
            <id>gen</id>
            <build>
                <defaultGoal>generate-sources</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>com.jaxio.celerio</groupId>
                        <artifactId>maven-celerio-plugin</artifactId>
                        <version>${maven-celerio-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>Generates files using the extracted database schema.</id>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>com.jaxio.celerio.packs</groupId>
                                <artifactId>backend-jpa</artifactId>
                                <version>${maven-celerio-plugin.version}</version>
                            </dependency>
                            <dependency>
                                <groupId>com.jaxio.celerio.packs</groupId>
                                <artifactId>jsf2-spring-conversation</artifactId>
                                <version>${maven-celerio-plugin.version}</version>
                            </dependency>
                            <dependency>
                                <groupId>com.jaxio.celerio.packs</groupId>
                                <artifactId>selenium-primefaces</artifactId>
                                <version>${maven-celerio-plugin.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
            <repositories>
                <repository>
                    <id>springfuse-repository</id>
                    <url>http://maven2.springfuse.com/</url>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>springfuse-repository</id>
                    <url>http://maven2.springfuse.com/</url>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    <dependencies>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>2.3</version>
        </dependency>
        <dependency>
            <groupId>org.jadira.usertype</groupId>
            <artifactId>usertype.core</artifactId>
            <version>3.0.0.GA</version>
        </dependency>
        <!-- ~~~~~~~~~~~ -->
        <!-- PERSISTENCE -->
        <!-- ~~~~~~~~~~~ -->
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <version>1.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>2.2.2</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jdbc</artifactId>
            <version>7.0.42</version>
        </dependency>
        <dependency>
            <!-- jdbc driver depends on the database profile used -->
            <groupId>${jdbc.groupId}</groupId>
            <artifactId>${jdbc.artifactId}</artifactId>
            <version>${jdbc.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-search</artifactId>
            <version>4.3.0.Final</version>
            <exclusions>
                <exclusion>
                    <artifactId>lucene-kuromoji</artifactId>
                    <groupId>org.apache.lucene</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-parsers</artifactId>
            <version>1.4</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.12</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.3.1.Final</version>
        </dependency>
        <dependency> <!-- validation html -->
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.7.2</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.5</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>1.7.5</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.7.5</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.0.13</version>
        </dependency>
        <!-- ~~~~~ -->
        <!-- UTILS -->
        <!-- ~~~~~ -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-jexl</artifactId>
            <version>2.1.1</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.8</version>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.8.3</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.1</version>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <version>1.6.2</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-lang</groupId>
                    <artifactId>commons-lang</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>velocity-tools</groupId>
            <artifactId>velocity-tools</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20090211</version>
        </dependency>
        <!-- ~~~~~~ -->
        <!-- SPRING -->
        <!-- ~~~~~~ -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.7.3</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.7.3</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-mongodb</artifactId>
            <version>${spring.data.mongodb.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-bindings-soap</artifactId>
            <version>2.4.0</version>
        </dependency>

        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-jaxrs</artifactId>
            <version>1.9.0</version>
        </dependency>
        <!-- ~~~~~~~~~~~~~~~ -->
        <!-- SPRING SECURITY -->
        <!-- ~~~~~~~~~~~~~~~ -->
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>jsr250-api</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-acl</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.el</groupId>
            <artifactId>jboss-el</artifactId>
            <version>2.0.1.GA</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.el</groupId>
                    <artifactId>el-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>${jsf-api.version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>${jsf-api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>${primefaces.version}</version>
        </dependency>
        <dependency>
            <groupId>org.omnifaces</groupId>
            <artifactId>omnifaces</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>  
        <groupId>org.primefaces.themes</groupId>  
        <artifactId>all-themes</artifactId>  
        <version>1.0.10</version>  
    </dependency>  
        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache-web</artifactId>
            <version>2.0.4</version>
        </dependency>
        <dependency><!-- optional theme (see also web.xml to enable it) -->
            <groupId>org.primefaces.themes</groupId>
            <artifactId>bootstrap</artifactId>
            <version>${primefaces-themes.version}</version>
        </dependency>
        <!-- Atmosphere -->
        <dependency>
            <groupId>org.atmosphere</groupId>
            <artifactId>atmosphere-runtime</artifactId>
            <version>2.0.2</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>net.bull.javamelody</groupId>
            <artifactId>javamelody-core</artifactId>
            <version>1.47.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.9.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.easytesting</groupId>
            <artifactId>fest-assert</artifactId>
            <version>1.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.35.0</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.palominolabs.xpath</groupId>
            <artifactId>xpath-utils</artifactId>
            <version>1.0.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-remote-shell</artifactId>
            <version>1.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-remote-shell</artifactId>
            <version>1.0.0.RELEASE</version>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>primefaces</id>
            <url>http://repository.primefaces.org</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>jboss</id>
            <url>http://repository.jboss.org/nexus/content/groups/public-jboss</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <!-- ~~~~~ -->
    <!-- BUILD -->
    <!-- ~~~~~ -->
    <build>
        <defaultGoal>jetty:run</defaultGoal>
        <resources>
            <resource>
                <directory>${maven-celerio-plugin.outputDir}/src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>${maven-celerio-plugin.outputDir}/src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>
        <pluginManagement>
        <plugins>
            <plugin>
                <!-- http://maven.apache.org/plugins/maven-resources-plugin/ -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <delimiters>
                        <delimiter>@*@</delimiter>
                    </delimiters>
                    <useDefaultDelimiters>false</useDefaultDelimiters>
                    <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>xls</nonFilteredFileExtension>
                        <nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
                        <nonFilteredFileExtension>pdf</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                </configuration>
            </plugin>
            <plugin>
                <!-- http://maven.apache.org/plugins/maven-enforcer-plugin/ -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.1.1</version>
                <executions>
                    <execution>
                        <id>enforce-java</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>[1.6.0-26,)</version>
                                </requireJavaVersion>
                                <requireMavenVersion>
                                    <version>3.0.3</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- http://maven.apache.org/plugins/maven-compiler-plugin/ -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                    <compilerArgument>-Xlint</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <!-- http://mojo.codehaus.org/build-helper-maven-plugin/ -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>Adding generated java folder to build</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${maven-celerio-plugin.outputDir}/src/main/java</source>
                                <source>${maven-celerio-plugin.outputDir}/src/main/generated-java</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>Adding generated java test location to test build</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${maven-celerio-plugin.outputDir}/src/test/java</source>
                                <source>${maven-celerio-plugin.outputDir}/src/test/generated-java</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>8.1.10.v20130312</version>
                <configuration>
                    <stopKey>foo</stopKey>
                    <stopPort>9999</stopPort>
                    <webAppConfig>
                        <contextPath>${application.contextpath}</contextPath>
                        <overrideDescriptor>${maven-celerio-plugin.outputDir}/src/main/config/maven-jetty-plugin/web-development.xml</overrideDescriptor>
                        <baseResource implementation="org.eclipse.jetty.util.resource.ResourceCollection">
                            <resourcesAsCSV>${project.basedir}/src/main/webapp/,${maven-celerio-plugin.outputDir}/src/main/webapp/</resourcesAsCSV>
                        </baseResource>
                    </webAppConfig>
                    <connectors>
                        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                            <port>${application.port}</port>
                        </connector>
                    </connectors>
                    <requestLog implementation="org.eclipse.jetty.server.NCSARequestLog">
                        <filename>${log.target}/jetty-yyyy_mm_dd-request.log</filename>
                        <retainDays>3</retainDays>
                        <append>true</append>
                        <extended>false</extended>
                        <logTimeZone>GMT</logTimeZone>
                    </requestLog>
                </configuration>
                <executions>
                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                        <configuration>
                            <daemon>true</daemon>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop-jetty</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- http://maven.apache.org/plugins/maven-failsafe-plugin/ -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.12</version>
                <configuration>
                    <systemPropertyVariables>
                        <selenium.baseurl>http://${application.host}:${application.port}${application.contextpath}</selenium.baseurl>
                    </systemPropertyVariables>
                    <argLine>${jacoco.it.agent.argLine}</argLine>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>verify</id>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-idea-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <jdkLevel>${jdk.version}</jdkLevel>
                    <dependenciesAsLibraries>true</dependenciesAsLibraries>
                    <useFullNames>false</useFullNames>
                </configuration>
            </plugin>
            <plugin>
                <!-- http://maven.apache.org/plugins/maven-eclipse-plugin/ -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <wtpversion>2.0</wtpversion>
                    <downloadSources>true</downloadSources>
                </configuration>
            </plugin>
            <plugin>
                <!-- http://maven.apache.org/plugins/maven-install-plugin/ -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>2.4</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.5</version>
            </plugin>
            <plugin>    
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12.4</version>
                <configuration>
                    <argLine>-Xmx512m -XX:MaxPermSize=256m ${jacoco.test.agent.argLine}</argLine>
                </configuration>
            </plugin>
            <plugin>
                <!-- http://maven.apache.org/plugins/maven-release-plugin/ -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.2.2</version>
                <configuration>
                    <arguments>-Pdb,metadata,gen</arguments>
                    <releaseProfiles>db,metadata,gen</releaseProfiles>
                </configuration>
            </plugin>
<plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <configuration>
                     <archive>
                        <manifestFile>./src/main/resources/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                        <webResources>
                            <resource>
                                <directory>${maven-celerio-plugin.outputDir}/src/main/webapp</directory>
                            </resource>
                        </webResources>
                    </configuration>
                </plugin>

        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions>
        <executions>
    <execution>
      <id>bundle-manifest</id>
      <phase>process-classes</phase>
      <goals>
        <goal>manifest</goal>
      </goals>
    </execution>
  </executions>
            <configuration>
                <supportedProjectTypes>
                    <supportedProjectType>war</supportedProjectType>
                </supportedProjectTypes>
                <manifestLocation>./src/main/resources/META-INF</manifestLocation>
                <instructions>
                     <Export-Package>com.bedas.ays.*</Export-Package> 
                    <Bundle-ClassPath>.,WEB-INF,{maven-dependencies}</Bundle-ClassPath>
                    <Embed-Dependency>*;scope=compile|runtime;</Embed-Dependency>
                    <Embed-Transitive>true</Embed-Transitive>
                    <Web-ContextPath>/ays</Web-ContextPath>
                    <Webapp-Context>ays</Webapp-Context>
                </instructions>
            </configuration>
        </plugin>
        </plugins>
        </pluginManagement>
    </build>
</project>

但是当我把它部署到karaf容器中时:

karaf@root()> bundle:install -s webbundle:file:///C://Users//Akin//Downloads//ap
ache-karaf-3.0.2//apache-karaf-3.0.2//deploy//ays-v.1.war

它总是给我一个这样的错误:

org.osgi.framework.BundleException: Duplicate import: javax.servlet.jsp

我还有一个MANIFEST.MF文件。在我做了mvn:install之后,这个文件仍然是空的。我哪里错了?我该怎么办?

您似乎正在创建(或至少尝试创建;)一个有效的WebApplicationBundle(WAB)。这样,您就不需要再添加webbundle:url处理程序了,因为您的bundle应该已经是一个有效的WAB了。

编辑

看起来你的POM关于maven捆绑包插件的使用是不正确的。可能还想在这里查看我想由于错误的工件类型(默认为捆绑包),它没有被启用,请检查您是否有以下内容来为战争工件启用它:

            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <supportedProjectTypes>
                    <supportedProjectType>jar</supportedProjectType>
                    <supportedProjectType>bundle</supportedProjectType>
                    <supportedProjectType>war</supportedProjectType>
                </supportedProjectTypes>

此外,您可能需要在说明中添加以下内容:

<_wab>src/main/webapp</_wab> 

相关内容

  • 没有找到相关文章

最新更新