簡體   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