Vaadin WAR still refer back to project folder

Hi,

from the WildFly console, I noticed Vaadin still refer back to my project folder.
I had already set productionMode = true. I’m bit lost. Hopefully anyone can help up.
Thank you so much…

attach with a picture showing the console.
and this is my pom.xml

Thanks again

<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>org.tzuchi.test18</groupId>
    <artifactId>test-18</artifactId>
    <name>Test 18</name>
    <version>1.0</version>
    <packaging>war</packaging>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <failOnMissingWebXml>false</failOnMissingWebXml>

        <vaadin.version>19.0.1</vaadin.version>
        <jetty.version>9.4.31.v20200723</jetty.version>
    </properties>

    <repositories>
        <!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->

        <!-- Main Maven repository -->
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <!-- Repository used by many Vaadin add-ons -->
        <repository>
            <id>Vaadin Directory</id>
            <url>https://maven.vaadin.com/vaadin-addons</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
     
    <pluginRepositories>
         <!-- Maven Central repository requires https:// to access -->
        <pluginRepository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <type>pom</type>
                <scope>import</scope>
                <version>${vaadin.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <!-- Replace artifactId with vaadin-core to use only free components -->
            <artifactId>vaadin</artifactId>
            <exclusions>
                <!-- Webjars are only needed when running in Vaadin 13 compatibility mode -->
                <exclusion>
                    <groupId>com.vaadin.webjar</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.insites</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.polymer</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.polymerelements</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.vaadin</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.webcomponents</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Added to provide logging output as Vaadin uses -->
        <!-- the unbound SLF4J no-operation (NOP) logger implementation -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-testbench</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>jetty:run</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
            </plugin>
            <!-- Jetty plugin for easy testing without a server -->
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <!-- If using IntelliJ IDEA with autocompilation, this
                    might cause lots of unnecessary compilations in the
                    background.-->
                    <scanIntervalSeconds>2</scanIntervalSeconds>
                    <!-- Use war output directory to get the webpack files -->
                    <webAppConfig>
                        <allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
                    </webAppConfig>
                </configuration>
            </plugin>

            <!--
                Take care of synchronizing java dependencies and imports in
                package.json and main.js files.
                It also creates webpack.config.js if not exists yet.
            -->
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-frontend</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- Production mode is activated using -Pproduction -->
            <id>production</id>
            <properties>
                <vaadin.productionMode>true</vaadin.productionMode>
            </properties>

            <dependencies>
                <dependency>
                    <groupId>com.vaadin</groupId>
                    <artifactId>flow-server-production-mode</artifactId>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>build-frontend</goal>
                                </goals>
                                  <phase>compile</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>it</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.eclipse.jetty</groupId>
                        <artifactId>jetty-maven-plugin</artifactId>
                        <version>${jetty.version}</version>
                        <configuration>
                            <scanIntervalSeconds>0</scanIntervalSeconds>
                            <stopPort>8081</stopPort>
                            <stopWait>5</stopWait>
                            <stopKey>${project.artifactId}</stopKey>
                        </configuration>
                        <executions>
                            <execution>
                                <id>start-jetty</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>deploy-war</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-jetty</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Runs the integration tests (*IT) after the server is started -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.22.2</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <trimStackTrace>false</trimStackTrace>
                            <enableAssertions>true</enableAssertions>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

This is my application.properties :

server.port=${PORT:8080}
logging.level.org.atmosphere = warn
spring.mustache.check-template-location = false
vaadin.productionMode = true

18566433.png

Any help? thanks…

I really don’t get it. why the production mode Vaadin war file still referring back my project folder.

Hi Ivan, are you building it with -Pproduction?

Your issue is that the WAR file is not being built in production mode, as the Webpack dev server is only run during development.

You can further confirm this by looking for the message Vaadin is running in DEBUG MODE in the logs. If you’re able to open the application in the browser, and type Vaadin.developmentMode in the browser development console, that probably returns true also.

Hi,

I’m using Eclipse, where should call this command ?
-Pproduction

Thanks for the reply :smiley:

I haven’t used Eclipse in a long time, but if you have a Run Configuration that you can edit, just add production under Profiles.

Erik Lumme:
I haven’t used Eclipse in a long time, but if you have a Run Configuration that you can edit, just add production under Profiles.

I can try that on InteliJ but which 1 i should click? any step for that? Im so sorry. I really lost at this section…

Do you run Maven at all? Just building through the IDE will not suffice.

From command line: mvn clean package -Pproduction
Eclipse Run Configurations: Maven Build, Goals = clean package, Profiles = production
IntelliJ Run/Debug Configurations: Maven, Command line = clean package, Profiles = production

If you have some Wildfly integration in Eclipse, I do not know how to configure it.
Perhaps by right clicking on your project → PropertiesMavenActive Maven Profiles (comma separated) = production.

THANK YOU SO MUCH, Erik! thank you!! finally… YES! now Vaadin run in production mode. I had set nothing in WildFly, just import the war file in, that all.

THANK YOU SO MUCH!! Please add this part in the tutorial.

Thank you again :smiley: I’m really really really really happppyyyyy

NOW Finally, I can develop using Vaadin! :smiley:

17:17:36,580 INFO  [org.wildfly.extension.undertow]
 (ServerService Thread Pool -- 92) WFLYUT0021: Registered web context: '/test-18-1.0' for server 'default-server'
17:17:36,622 INFO  [org.jboss.as.server]
 (External Management Request Threads -- 1) WFLYSRV0010: Deployed "test-18" (runtime-name : "test-18-1.0.war")
17:18:10,642 INFO  [com.vaadin.flow.server.DefaultDeploymentConfiguration]
 (default task-1) Vaadin is running in production mode.

Awesome! I’ll share the suggestion of adding it to a tutorial with my colleagues, happy coding :slight_smile:

Hi,

few comments. for war pom.xml format. actually this skeleton starter is good enough for war file :
skeleton-starter-flow-14

the tutorial there a bit confuse and few like things are a bit here and there :stuck_out_tongue:
actually it is quite simple haha

https://vaadin.com/docs/v14/guide/production
Hope you may add war file generation in this section as well :smiley:
I found out a lot people mentioned must add
vaadin.productionMode = true
in
application.properties

but, again. this part also not mentioned at all the user guide :smiley:

Hope Vaadin can improve the tutorial and user guide. I started playing around Vaadin since 2019 :stuck_out_tongue:
but couldn’t get it.

again, thanks for your help. finally solved all my issues :smiley:
now i started love vaadin. the only issues is the website. :slight_smile: