0

i am tring to run spring boot application without eclipse so when i run the jar file after running mvn clean install and got build success i got this error

no main manifest attribute

here is my pom.xml

i think there is duplication i am using angular with it

    <?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>guru.springframework</groupId>
    <version>0.0.1-SNAPSHOT</version>
    <!-- <packaging>war</packaging> -->
    <packaging>jar</packaging>

    <name>Clever Zone Web Application</name>
    <description>Clever Zone Web Application</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <!-- <version>1.2.4.RELEASE</version> -->
        <version>1.3.3.RELEASE</version>
        <relativePath />
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>

    </properties>

    <repositories>
        <repository>
            <id>jcenter</id>
            <name>bintray</name>
            <url>http://jcenter.bintray.com</url>
        </repository>
    </repositories>

    <dependencies>

        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>javax.el-api</artifactId>
            <version>2.2.4</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.beust/jcommander -->
        <dependency>
            <groupId>com.beust</groupId>
            <artifactId>jcommander</artifactId>
            <version>1.7</version>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.10</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-websocket</artifactId>
            <version>8.0.23</version>
        </dependency>



        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.2.4.Final</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>

        <!--WebJars -->

        <!-- https://mvnrepository.com/artifact/hsqldb/hsqldb -->
        <dependency>
            <groupId>hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>1.8.0.10</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- testing jason -->

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.8.8</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.8.8</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.8.8</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-support -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-support</artifactId>
            <version>2.0a7</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-chrome-driver</artifactId>
            <version>3.4.0</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-maven-plugin -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>1.5.3.RELEASE</version>
</dependency>


    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
            </resource>
            <resource>
                <directory>${project.build.directory}/generated-resources</directory>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>

                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <executions>
                        <execution>
                            <!-- Serves *only* to filter the wro.xml so it can get an absolute 
                                path for the project -->
                            <id>copy-resources</id>
                            <phase>validate</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${basedir}/target/wro</outputDirectory>
                                <resources>
                                    <resource>
                                        <directory>src/main/wro</directory>
                                        <filtering>true</filtering>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>1.5.3.RELEASE</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
                <plugin>
                    <groupId>ro.isdc.wro4j</groupId>
                    <artifactId>wro4j-maven-plugin</artifactId>
                    <version>1.7.6</version>
                    <executions>
                        <execution>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
                        <cssDestinationFolder>${project.build.directory}/generated-resources/static/css</cssDestinationFolder>
                        <jsDestinationFolder>${project.build.directory}/generated-resources/static/js</jsDestinationFolder>
                        <wroFile>${project.build.directory}/wro/wro.xml</wroFile>
                        <extraConfigFile>${basedir}/src/main/wro/wro.properties</extraConfigFile>
                        <contextFolder>${basedir}/src/main/wro</contextFolder>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.webjars</groupId>
                            <artifactId>jquery</artifactId>
                            <version>2.1.1</version>
                        </dependency>
                        <dependency>
                            <groupId>org.webjars</groupId>
                            <artifactId>angularjs</artifactId>
                            <version>1.3.8</version>
                        </dependency>
                        <dependency>
                            <groupId>org.webjars</groupId>
                            <artifactId>bootstrap</artifactId>
                            <version>3.2.0</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <artifactId>CleverZone</artifactId>

    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>


</project>

the main class is in guru/springframework

here is running jar tf on the jar "some of it"

META-INF/maven/
META-INF/maven/guru.springframework/
META-INF/maven/guru.springframework/CleverZone/
META-INF/maven/guru.springframework/CleverZone/pom.xml
META-INF/maven/guru.springframework/CleverZone/pom.properties
guru/springframework/SpringBootWebApplication.class

thanks in advance

Nour Ahmed
  • 21
  • 1
  • 4
  • Remove the maven-assembly-plugin and add the spring-boot-maven-plugin and let that do the work. – dunni May 20 '17 at 17:25
  • tried that already and i got the same error – Nour Ahmed May 20 '17 at 17:30
  • 1
    If the pom, that you added, is from the spring-boot-maven-plugin try, then you have to add it to the section build/plugins/plugin, not build/pluginManagement/plugins/plugin. – dunni May 20 '17 at 17:52
  • possible duplicate of : http://stackoverflow.com/questions/9689793/cant-execute-jar-file-no-main-manifest-attribute – Raghvendra Kumar May 20 '17 at 17:59
  • Possible duplicate of [Can't execute jar- file: "no main manifest attribute"](http://stackoverflow.com/questions/9689793/cant-execute-jar-file-no-main-manifest-attribute) – Raghvendra Kumar May 20 '17 at 17:59
  • @dunni no it is inside build/pluginManagement/plugins/plugin – Nour Ahmed May 20 '17 at 19:46
  • 1
    Which is wrong, it has to be in build/plugins/plugin to take effect. pluginManagement is considered like a template for configuration of plugins, which can then just be activated in child poms without specifying the config again. But it has to be in build/plugins/plugin to be activated for that module. – dunni May 20 '17 at 20:04
  • it works man you saved my life @dunni – Nour Ahmed May 20 '17 at 20:30
  • @dunni, you just saved me too, thanks. – Killer Death Oct 20 '17 at 09:20

0 Answers0