Home > Mobile >  Vaadin SpringBoot = no main manifest attribute, in file.war
Vaadin SpringBoot = no main manifest attribute, in file.war

Time:11-11

I have a webapp in Vaadin 14 LTS. When I run the webapp in INTELLIJ it runs normally (in development mode), but when I compile it in production mode with "mvn clean package -Pproduction" and then run with "java -jar smcweb.war" I get the message "no main manifest attribute, in smcweb.war". I have several APIs created with SpringBoot and I can run them normally with "java -jar ..."

Something curious: I use the apexcharts chart library. When from INTELLIJ I execute the webapp with "spring-boot:run" it is shown in the console:

[INFO] --- spring-boot-maven-plugin:2.5.4:run (default-cli) @ smcweb ---
[INFO] Attaching agents: []
Listening for transport dt_socket at address: 5230
                                 _                   _        
  __ _  _ __    ___ __  __  ___ | |__    __ _  _ __ | |_  ___ 
 / _` || '_ \  / _ \\ \/ / / __|| '_ \  / _` || '__|| __|/ __|
| (_| || |_) ||  __/ >  < | (__ | | | || (_| || |   | |_ \__ \
 \__,_|| .__/  \___|/_/\_\ \___||_| |_| \__,_||_|    \__||___/
       |_|                                                    

...instead of the typical Spring Boot console output:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.5.4)

Below is the POM.xml file

PD: It is possible that some residue of PAYARA MICRO has been left in the POM.XML. Previously we deployed with PAYARA MICRO.

Thanks in advance!

I have tried some solutions in MAVEN, like this. All of them without success.

CodePudding user response:

If your goal is to build a self contained system using java -jar a web application archive (war) is not the right format for your application. You should consider using jar and proper spring boot configuration for it.

Additionally, the apex chart addon is providing a banner.txt which it shouldn't do, therefore you get the mentioned logo, instead of your own / spring boot's default.

CodePudding user response:

Here the pom.xml:

<?xml version="1.0" encoding="UTF-8"?>

4.0.0

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.5.4</version>
</parent>


<groupId>com.griser</groupId>
<artifactId>smcweb</artifactId>
<version>2.9.0</version>
<packaging>war</packaging>
<name>smc-web-app</name>
<description>SMC-WEBAPP</description>

<properties>
    <spring-boot.repackage.skip>true</spring-boot.repackage.skip>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <vaadin.version>14.8.10</vaadin.version>
    <log4j2.version>2.17.2</log4j2.version>
    <version.microprofile>4.0.1</version.microprofile>

    <!-- PAYARA MICRO PLUGIN -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <version.concurrencyUtilities>1.1</version.concurrencyUtilities>
    <version.jca>1.7</version.jca>
    <version.jbatch>1.0.1</version.jbatch>
    <version.payara>5.194</version.payara>
</properties>

<dependencies>

    <dependency>
        <groupId>com.vaadin</groupId>
        <!-- Replace artifactId with vaadin-core to use only free components -->
        <artifactId>vaadin</artifactId>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-validation</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-testbench</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <scope>test</scope>
    </dependency>

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

       <!-- DIERGUI -->

    <dependency>
        <groupId>com.vaadin.componentfactory</groupId>
        <artifactId>explorer-tree-grid-flow</artifactId>
        <version>1.0.4</version>
        <type>jar</type>
    </dependency>

    <dependency>
        <groupId>com.github.appreciated</groupId>
        <artifactId>apexcharts</artifactId>
        <version>2.0.0.beta11</version>
    </dependency>

    <dependency>
        <groupId>org.vaadin.gatanaso</groupId>
        <artifactId>multiselect-combo-box-flow</artifactId>
        <version>3.0.2</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>5.0.0</version>
        <type>jar</type>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-csv -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-csv</artifactId>
        <version>1.8</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-text -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-text</artifactId>
        <version>1.9</version>
    </dependency>

    <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.9.2</version>
        <type>jar</type>
    </dependency>


    <!-- https://mvnrepository.com/artifact/org.eclipse.paho/org.eclipse.paho.client.mqttv3 -->
    <dependency>
        <groupId>org.eclipse.paho</groupId>
        <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
        <version>1.2.4</version>
    </dependency>

    <dependency>
        <groupId>com.storedobject.chart</groupId>
        <artifactId>so-charts</artifactId>
        <version>0.0.5</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.8.5</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/joda-time/joda-time -->
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.10</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/commons-net/commons-net -->
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet</artifactId>
        <version>3.0.2</version>
    </dependency>

    <!-- if you are using Jersey client specific features without the server side -->
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>2.8</version>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-bundle</artifactId>
        <version>1.19.2</version>
        <type>jar</type>
    </dependency>

    <dependency>
        <groupId>commons-net</groupId>
        <artifactId>commons-net</artifactId>
        <version>3.3</version>
    </dependency>

    <dependency>
        <groupId>org.greenrobot</groupId>
        <artifactId>eventbus</artifactId>
        <version>3.1.1</version>
        <type>jar</type>
    </dependency>

    <dependency>
        <groupId>org.vaadin.addons</groupId>
        <artifactId>timer</artifactId>
        <version>1.0.1</version>
    </dependency>

    <dependency>
        <groupId>org.vaadin.tabs</groupId>
        <artifactId>paged-tabs</artifactId>
        <version>2.0.1</version>
        <type>jar</type>
    </dependency>

    <dependency>
        <groupId>org.vaadin.jchristophe</groupId>
        <artifactId>sortable-layout</artifactId>
        <version>0.5.0</version>
    </dependency>

    <dependency>
        <groupId>io.github.tobsef</groupId>
        <artifactId>speed-dial</artifactId>
        <version>1.1.4</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.22</version>
        <scope>provided</scope>
    </dependency>

    <!-- https://vaadin.com/directory/component/zxingvaadin# -->
    <dependency>
        <groupId>com.wontlost</groupId>
        <artifactId>zxing-vaadin</artifactId>
        <version>1.0.3</version>
        <type>jar</type>
    </dependency>

    <dependency>
        <groupId>org.vaadin.stefan</groupId>
        <artifactId>html-table</artifactId>
        <version>1.1.1</version>
    </dependency>


</dependencies>

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

<build>

    <finalName>${project.artifactId}</finalName>

    <plugins>

        <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <!-- Use the latest released version:
            https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
            <version>1.12.1</version>

            <executions>
                <execution>
                    <!-- optional: you don't really need execution ids, but it looks nice in your build log. -->
                    <id>install node and npm</id>
                    <goals>
                        <goal>install-node-and-npm</goal>
                    </goals>
                    <!-- optional: default phase is "generate-resources" -->
                    <phase>generate-resources</phase>
                </execution>
            </executions>
            <configuration>
                <nodeVersion>v13.14.0</nodeVersion>
                <downloadRoot>https://nodejs.org/dist/</downloadRoot>
                <!-- optional: with node version greater than 4.0.0 will use npm provided by node distribution -->
                <!--                    <npmVersion>2.15.9</npmVersion>-->

                <!-- optional: where to download node and npm from. Defaults to https://nodejs.org/dist/ -->
                <!--                    <downloadRoot>http://myproxy.example.org/nodejs/</downloadRoot>-->
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <!-- Clean build and startup time for Vaadin apps sometimes may exceed
                 the default Spring Boot's 30sec timeout.  -->
            <configuration>
                <jvmArguments>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5230</jvmArguments>
                <wait>500</wait>
                <maxAttempts>240</maxAttempts>
            </configuration>
        </plugin>

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

    </plugins>

</build>

<profiles>

    <profile>
        <id>development</id>
        <properties>
        </properties>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
    </profile>

    <profile>
        <id>production</id>
        <properties>
            <spring.profiles.active>production</spring.profiles.active>
        </properties>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.vaadin</groupId>
                    <artifactId>vaadin-maven-plugin</artifactId>
                    <version>${vaadin.version}</version>
                    <executions>
                        <execution>
                            <id>frontend</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>prepare-frontend</goal>
                                <goal>build-frontend</goal>
                            </goals>
                            <configuration>
                                <productionMode>true</productionMode>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>

</profiles>

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

    <repository>
        <id>projectlombok.org</id>
        <name>Lombok Repository</name>
        <url>http://projectlombok.org/mavenrepo</url>
    </repository>

    <repository>
        <id>vaadin-addons</id>
        <url>https://maven.vaadin.com/vaadin-addons</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>

</repositories>

<pluginRepositories>
    <!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->
    <pluginRepository>
        <id>central</id>
        <url>https://repo.maven.apache.org/maven2</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </pluginRepository>
    <pluginRepository>
        <id>vaadin-prereleases</id>
        <url>
            https://maven.vaadin.com/vaadin-prereleases/
        </url>
    </pluginRepository>
</pluginRepositories>
  • Related