maven 如何将Angular应用程序部署到WAR/WAR中的weblogic服务器

rhfm7lfc  于 11个月前  发布在  Maven
关注(0)|答案(2)|浏览(141)

我正在尝试将Angular应用程序部署到WeblogicApplication服务器中。
不幸的是,这是行不通的。
我做的是:
1)构建我的Angular应用程序(exec-maven-plugin),并将结果放入“/dist”文件夹
2)构建一个包含“/dist”文件夹的WAR文件(maven-war-plugin),这样我就有了一个普通的War文件,其中的distfolder位于根级别(没有xml文件)。
3)使用以下命令构建一个JavaScript文件(maven-ear-plugin):

<modules>
       <webModule>
           <groupId>com.example.test</groupId>
           <artifactId>angular-app</artifactId>
           <contextRoot>angular-app</contextRoot>
       </webModule>
   </modules>

字符串
所以我得到了一个包含war文件和application.xml的JAR文件:

<module>
    <web>
      <web-uri>angular-app-1.0.0-SNAPSHOT.war</web-uri>
      <context-root>angular-app</context-root>
    </web>
  </module>


但是当我尝试打开应用程序时,无论什么URL,我都只能得到一个“Not found”页面或“Error 404-Not Found”:

hostname:8080/angular-app/dist/index.html
  hostname:8080/dist/index.html


或其他组合
我必须做什么才能使angular应用程序可用?
编辑:首先,我通过SCP将文件复制到服务器,然后通过Web控制台部署文件。

ruyhziif

ruyhziif1#

请确保您使用的是base-hrefdeploy-url参数

ng build --base-href /angular-app/ --deploy-url /angular-app/

字符串
WEB-INF文件夹中**dist//**文件夹内的create WEB-INF文件夹create web.xml和weblogic.xml使用标准约定

taor4pac

taor4pac2#

1. create a empty spring boot project with war configuration and use the below code to copy dist folder of anugalr app.

deploy the war to weblogic.

<build>
        <finalName>WarName</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <warSourceDirectory>dist/npr</warSourceDirectory>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </build>

字符串

相关问题