0

I have an Jhipster Monolithic application, where when I use mvn clean install I build my frontend into the target folder and then can simulteanously start my backend and frontend reaching them with localhost:8080. But There is also the admin ui of jhipster which I had to comment out so in order for my frontend to be build.

Is there any possible way to build both frontnend angular projects into the target folder without them overwriting each other? For example I want to let my own angular project be buil and reached through localhost:8080 and the admin ui through localhost:8081 after build but right now the admin ui is overwriting my own angular ui.

This is how my pom looks: My own angular project:

            <!--Building frontend -->

            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <configuration>
                    <workingDirectory>ui</workingDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>install-node-and-npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>${node.version}</nodeVersion>
                            <npmVersion>${npm.version}</npmVersion>
                        </configuration>
                    </execution>

                    <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>webapp build dev</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <arguments>run build --verbose</arguments>
                            <environmentVariables>
                                <APP_VERSION>${project.version}</APP_VERSION>
                            </environmentVariables>
                            <npmInheritsProxyConfigFromMaven>false</npmInheritsProxyConfigFromMaven>
                        </configuration>
                    </execution>

                </executions>
            </plugin>

            <!--Building frontend ends-->

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>src/main/resources/static</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>ui/dist/apps/nosi</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <!--Copy files ends-->

And the admin ui which is generated by jhipster:

           <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install-node-and-npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>${node.version}</nodeVersion>
                            <npmVersion>${npm.version}</npmVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>webapp build dev</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <arguments>run webapp:build</arguments>
                            <environmentVariables>
                                <APP_VERSION>${project.version}</APP_VERSION>
                            </environmentVariables>
                            <npmInheritsProxyConfigFromMaven>false</npmInheritsProxyConfigFromMaven>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

It is executed directly after my own build thats probably the reason why its overwritten but how can I make them build alongside each other and make them work together

natyus
  • 577
  • 1
  • 4
  • 19
  • Having your app listening on 2 ports require some work, see https://stackoverflow.com/questions/36357135/configure-spring-boot-with-two-ports Personally I would prefer to use a single port and uses a path prefix for admin UI (e.g. /admin) and I would put the 2 angular apps in their own maven module – Gaël Marziou Dec 30 '22 at 20:25
  • First of thanks for your answer isn’t it possible to do it with one mvn module? – natyus Dec 31 '22 at 07:48
  • Yes probably but if you want to have 2 ports, it means to have 2 angular apps with each one having a dedicated `bootstrapModule` and `package.json` and organize your source folders to reflect that, quite complex for a single maven module, much simpler in multi modules. It would be easier to have only one port and one angular app and managing an admin route inside it for JHipster generated UI, this is in fact what JHipster expects you to do as the routes are already defined this way. – Gaël Marziou Dec 31 '22 at 08:39

0 Answers0