【发布时间】:2018-02-12 14:14:22
【问题描述】:
我正在尝试将 war 文件(包含我的 java 后端)和一些静态内容(包含已编译的 Angular 项目)部署到码头服务器。
首先它可以工作,但我想改进部署。 目前我的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 上的第一个问题,如果我写的太模糊,请见谅。
我愿意接受批评。
感谢您的努力和回答!
【问题讨论】:
标签: angular maven web-applications deployment jetty