John Smith
John Smith

Reputation: 752

Production build JHipster with Joinfaces. Howto specify where to look for xhtml files

I have just started to integrate JoinFaces into JHipster, which was really easy.

Following the example of JoinFaces, I put xhtml files to src/resources/META-INF/resources

Normal builds like mvn -Pdev spring-boot:run run without any problems.

I struggle at just one last piece in the puzzle, the production build. As stated above, xhtml files are stored in src/resources/META-INF/resources. After a production build mvn -Pprod package, they are located inside the war at /WEB-INF/classes/META-INF/resources/.

Running the application results in Status: Not Found (Not Found) Message: Not Found at http://localhost:8080/index.jsf

How am I fixing this? I really have no idea where the jhipster spring-boot app expects them to be. Then I could adjust the pom accordingly (thinking maven-resource plugin)

Upvotes: 0

Views: 420

Answers (1)

John Smith
John Smith

Reputation: 752

Why not the other way around? Put them in the location where JSF can find them?

Good idea. So playing around with it a bit more, I figured out that jhipster expects html files to be in target/www/ when running into the package phase of Maven. I use the maven-resources-plugin for that.

The following adjustments to the pom.xml have been made:

<profiles>
    <profile>
        <id>prod</id>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-undertow</artifactId>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                    <executions>
                        <execution>
                            <id>copy-resources</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${basedir}/target/www/</outputDirectory>
                                <resources>
                                    <resource>
                                        <directory>src/main/resources/META-INF/resources/</directory>
                                        <filtering>false</filtering>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

I have also excluded the src/main/resources/ from sonar

<sonar.exclusions>src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*,src/main/resources/META-INF/**/*.*,
        src/main/webapp/i18n/*.js, target/www/**/*.*
</sonar.exclusions>

Upvotes: 0

Related Questions