首页 文章

码头|部署战争和静态内容

提问于
浏览
0

我正在尝试将war文件(包含我的java后端)和一些静态内容(包含已编译的角度项目)部署到jetty服务器 .

首先它可以工作,但我想改进部署 . 目前我的war文件是从webapp-project的目标目录部署的 . 静态内容(角度项目)从包含web.xml的WEB-INF文件夹所在的src / main / webapp目录进行部署 .

但如果我可以从目标文件夹中部署(war文件和静态内容),那将是很好的 .

我在pom.xml中的当前配置:

<project xmlns="..." xmlns:xsi="..."
xsi:schemaLocation="...">
<modelVersion>4.0.0</modelVersion>
<groupId>...</groupId>
<artifactId>SurefireAuswerterBackend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-jetty-http</artifactId>
        <version>2.25.1</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-jetty-servlet</artifactId>
        <version>2.25.1</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.2.20.v20161216</version>
            <dependencies>
                <dependency>
                    <groupId>org.eclipse.jetty</groupId>
                    <artifactId>jetty-io</artifactId>
                    <version>9.2.20.v20161216</version>
                </dependency>
            </dependencies>
            <configuration>
                <scanIntervalSeconds>10</scanIntervalSeconds>
                <war>${project.basedir}/target/surefire-auswerter.war</war>
                <stopKey>alpha</stopKey>
                <stopPort>4445</stopPort>
                <httpConnector>
                    <port>4444</port>
                </httpConnector>
                <webAppSourceDirectory>${project.basedir}/target/surefire-auswerter</webAppSourceDirectory>
                <webAppConfig>
                    <contextPath>/surefire-auswerter</contextPath>
                </webAppConfig>
            </configuration>
        </plugin>
    </plugins>
</build>

我删除了一些不重要的配置 .

我尝试了很多例如设置WebAppSourceDirectory但没有任何效果 . 是否有任何解决方案总是使用或做我想要的?

PS:请原谅我的语言 - 我还不是很熟练的英语 . 此外,这是我在StackOverlow上的第一个问题,所以如果我写的东西太模糊,请原谅 .

我接受批评 .

谢谢你的努力和答案!

1 回答

相关问题