Angular WAR 构建
Angular WAR build
我想构建 Angular 5 个应用程序到 .war 并从 JBoss.
部署和 运行 它
我有 angular 5 个带有 Maven 的应用程序,用于 .war 构建。在 JBoss 部署期间出现错误,但我可以在 WEB-INF 中制作 WebContent 目录后部署,但无法访问该站点。我不确定我的 POM/WEB.XML 是否配置正确。
我正在使用 mvn compile war:war
构建
我没有使用 Maven 的经验,所以如果你能帮助我,我将不胜感激。
POM.XML
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.vdb</groupId>
<artifactId>vdb</artifactId>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>dist</directory>
<includes>
<include>*</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v8.9.1</nodeVersion>
<npmVersion>5.5.1</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>prod</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run-script prod</arguments>
</configuration>
<phase>generate-resources</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<webXml>.\WEB-INF\web.xml</webXml>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>./dist/</directory>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
和WEB.XML
<?xml version="1.0" encoding="ISO-8859-1" ?><web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>VDB WebApp</display-name>
<description>
</description>
<servlet>
<servlet-name>VDBWeb</servlet-name>
<servlet-class>vdb.Servlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>VDBServlet</servlet-name>
<url-pattern>/vdb</url-pattern>
</servlet-mapping>
结果是 servlet 名称需要匹配。我还尝试在需要转到 /warname 的地方打开 /vdb。
我们可以在构建 angular 之后使用以下命令分别为 angular 代码构建 war 使用 ng build 然后导航到 dist 文件夹并执行
jar -cvf angularUI.war *
我想构建 Angular 5 个应用程序到 .war 并从 JBoss.
部署和 运行 它我有 angular 5 个带有 Maven 的应用程序,用于 .war 构建。在 JBoss 部署期间出现错误,但我可以在 WEB-INF 中制作 WebContent 目录后部署,但无法访问该站点。我不确定我的 POM/WEB.XML 是否配置正确。
我正在使用 mvn compile war:war
构建我没有使用 Maven 的经验,所以如果你能帮助我,我将不胜感激。
POM.XML
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.vdb</groupId>
<artifactId>vdb</artifactId>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>dist</directory>
<includes>
<include>*</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v8.9.1</nodeVersion>
<npmVersion>5.5.1</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>prod</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run-script prod</arguments>
</configuration>
<phase>generate-resources</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<webXml>.\WEB-INF\web.xml</webXml>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>./dist/</directory>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
和WEB.XML
<?xml version="1.0" encoding="ISO-8859-1" ?><web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>VDB WebApp</display-name>
<description>
</description>
<servlet>
<servlet-name>VDBWeb</servlet-name>
<servlet-class>vdb.Servlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>VDBServlet</servlet-name>
<url-pattern>/vdb</url-pattern>
</servlet-mapping>
结果是 servlet 名称需要匹配。我还尝试在需要转到 /warname 的地方打开 /vdb。
我们可以在构建 angular 之后使用以下命令分别为 angular 代码构建 war 使用 ng build 然后导航到 dist 文件夹并执行
jar -cvf angularUI.war *