简体   繁体   中英

Differenet Errors while running maven project with existing pom.xml to netbeans

this is my first project using Spring (and I'm not too experienced with Maven either) I tried to import a new maven project with existing pom.xml to netbeans. I saw a lot of questions asked here before but the answers didn't fix these errors.

mvn clean install return this error

[INFO] ----------------------------------------------------------------------- [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin :1.2.0.RELEASE:repackage (default) on project ssh-on-web: Execution default of g oal org.springframework.boot:spring-boot-maven-plugin:1.2.0.RELEASE:repackage fa iled: Unable to find main class -> [Help 1]

Also when i try to run the maven web-application with tomcat it returns this error :

Undeploying ... undeploy?path=/ OK - Application non déployée pour le chemin de contexte / In-place deployment at C:\\Users\\admin\\Desktop\\ssh-on-web-master\\target\\ssh-on-web-1.0-SNAPSHOT Deployment is in progress... deploy?config=file%3A%2FC%3A%2FUsers%2Fadmin%2FAppData%2FLocal%2FTemp%2Fcontext6208589662765502295.xml&path=/ ECHEC - Application déployée pour le chemin de contexte / mais le démarrage du contexte a échoué

here you find how the pom.xml looks like : pom.xml

    <?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>
        <packaging>war</packaging>

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

        <groupId>ssh-on-web</groupId>
        <artifactId>ssh-on-web</artifactId>
        <version>1.0-SNAPSHOT</version>

        <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>
        </properties>

        <dependencies>
            <dependency>
                <groupId>com.hierynomus</groupId>
                <artifactId>sshj</artifactId>
                <version>0.11.0</version>
            </dependency>
            <dependency>
                <groupId>net.sf.expectit</groupId>
                <artifactId>expectit-core</artifactId>
                <version>0.6.1</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-websocket</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
                <!--<scope>provided</scope>-->
            </dependency>
            <dependency>
                <groupId>javax.el</groupId>
                <artifactId>javax.el-api</artifactId>
                <version>2.2.4</version>
            </dependency>
        </dependencies>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
            <mainClass>com.kodcu.ApplicationStarter</mainClass>
            <layout>ZIP</layout>
            <goal> run </goal>
          </configuration>
                </plugin>
            </plugins>
        </build>


    </project>

and this is how my project directories looks like : My web-application tree

Best regards

I had the same problem, I found out later that I had put pom.xml in the wrong directory. I had put it in: src/main/java/ . The correct location for pom.xml is in the src folder, at the same level with the main folder.

If you made the same error, just put it in the right folder in src , and then run mvn clean install again, and it'll run just fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM