0

I am trying to create ROOT.war to deploy my app to Azure. I have no error in my build after I run

 mvn clean install Pprod 

but my ROOT.war is missing index.html.

Here is my pom.xml

<build>
            <finalName>ROOT</finalName>
            <plugins>
                <!-- Plugin to execute command "npm install" and "npm run build" inside
                    /angular directory -->
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>1.12.0</version>
                    <configuration>
                        <workingDirectory>angular</workingDirectory>
                        <installDirectory>target</installDirectory>
                            <bowerInheritsProxyConfigFromMaven>false</bowerInheritsProxyConfigFromMaven>
                    </configuration>
                    <executions>
                        <!-- It will install nodejs and npm -->
                        <execution>
                            <id>install node and npm</id>
                            <goals>
                                <goal>install-node-and-npm</goal>
                            </goals>
                            <configuration>
                                <nodeVersion>v10.17.0</nodeVersion>
                                <npmVersion>6.11.3</npmVersion>
                            </configuration>
                        </execution>

                        <!-- It will execute command "npm install" inside "/angular" directory -->

                        <execution>
                            <id>ng build</id>
                            <goals>
                                <goal>npm</goal>
                            </goals>
                            <configuration>
                                <arguments>run-script build</arguments>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                    <executions>
                        <execution>
                            <id>default-copy-resources</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <overwrite>true</overwrite>
                                <outputDirectory>
                                    ${project.build.directory}/${project.artifactId}/
                                </outputDirectory>
                                <resources>
                                    <resource>
                                        <directory>${project.basedir}/application/dist</directory>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>

and here is my package.json

  "scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxyconfig.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"prod": "ng build --prod --base-href /"

},

the output of the build / content of root.war is as follows:

enter image description here

I have read all this threads but they didn't help

Spring-React frontend-maven-plugin not working

Maven ignores maven-frontend-plugin, no error

I have also tried to build my root.war with several different maven-frontend-plugin versions, and also with different versions of node.

Thank you!

LaCodeM
  • 645
  • 7
  • 23
  • 1
    maven-resources-plugin is copying from application/dist but maven-frontend-plugin is running in angular. Without seeing your file system layout it's hard to tell but maybe you need to specify angular/dist to the maven-resources-plugin instead of application/dist – httPants Aug 12 '21 at 07:31
  • Thank you, your answer led me to the good way and I was able to deploy my app. – LaCodeM Aug 12 '21 at 09:31

0 Answers0