如何在kumuluz ee框架中将jar转换为战争?

时间:2017-02-10 14:10:18

标签: java eclipse maven java-ee spring-boot

我有多个单独的jar文件Web应用程序,并希望更改为war文件,以便部署在java企业容器中,如jboss,glassfish,websphere等。我只能将其作为独立应用程序运行,需要在java EE中部署容器

我正在使用kumuluz EE微框架。

访问https://github.com/tfaga/KumuluzEE

1 个答案:

答案 0 :(得分:0)

删除kumuluz-servlet和jetty部分并添加javaee-web-api。 并使用以下依赖项来构建它。

 <dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.kumuluz.ee</groupId>
        <artifactId>kumuluzee-core</artifactId>
        <version>${kumuluzee.version}</version>
    </dependency>
    <dependency>
        <groupId>com.kumuluz.ee</groupId>
        <artifactId>kumuluzee-jax-rs-jersey</artifactId>
        <version>${kumuluzee.version}</version>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>       
</dependencies>
<build>
    <finalName>project_name</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
                <archive>
                    <manifest>
                        <mainClass>com.kumuluz.ee.EeApplication</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

当然,包装为&#34; war&#34;文件。