繁体   English   中英

使用现有pom.xml将Maven项目运行到NetBeans时出现Differenet错误

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

这是我使用Spring的第一个项目(我对Maven也没有太多的经验),我尝试将具有现有pom.xml的新maven项目导入到netbeans。 我以前在这里看到过很多问题,但是答案并不能解决这些错误。

mvn clean install返回此错误

[INFO] ----------------------------------------------- ------------------------ [错误]无法执行目标org.springframework.boot:spring-boot-maven-plugin:1.2.0.RELEASE :在项目ssh-on-web上的repackage(默认):执行默认的org.springframework.boot:spring-boot-maven-plugin:1.2.0.RELEASE:repackage失败:无法找到主类-> [帮助1]

另外,当我尝试使用tomcat运行Maven Web应用程序时,它也会返回此错误:

取消部署... undeploy?path = /正常-应用程序无法部署上下文/在C:\\ Users \\ admin \\ Desktop \\ ssh-on-web-master \\ target \\ ssh-on-web-进行就地部署1.0-SNAPSHOT部署正在进行中……deploy?config = file%3A%2FC%3A%2FUsers%2Fadmin%2FAppData%2FLocal%2FTemp%2Fcontext6208589662765502295.xml&path = / ECHEC-应用程序/上下文教育背景

在这里,您可以找到pom.xml的外观: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>

这就是我的项目目录的样子: 我的Web应用程序树

最好的祝福

我遇到了同样的问题,后来我发现我将pom.xml放在错误的目录中。 我把它放在: src/main/java/ pom.xml的正确位置在src文件夹中,与main文件夹位于同一级别。

如果您犯了同样的错误,只需将其放在src的正确文件夹中,然后再次运行mvn clean install ,它将正常运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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