【问题标题】:Maven Build Success, but no result in target folderMaven 构建成功,但在目标文件夹中没有结果
【发布时间】:2021-03-02 00:08:04
【问题描述】:

对于初学者来说,我与 Maven 的合作并不多。

除了未指定版本外,我一切正常,但是当我在 pom.xml 中指定了 Maven 版本时,它仍然无法正常工作。

注意:每次运行都显示“构建成功”,但没有人将完成的 jar 文件放在目标文件夹中,这是我认为应该发生的。

这是我的 eclipse 输出:

[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------< TromboneSMP:VoluntaryPullFromEternity >----------------
[INFO] Building VoluntaryPullFromEternity 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ VoluntaryPullFromEternity ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ VoluntaryPullFromEternity ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Users\Roboverse\eclipse-workspace\VoluntaryPullFromEternity\target\classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ VoluntaryPullFromEternity ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ VoluntaryPullFromEternity ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ VoluntaryPullFromEternity ---
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ VoluntaryPullFromEternity ---
[INFO] Building jar: C:\Users\Roboverse\eclipse-workspace\VoluntaryPullFromEternity\target\VoluntaryPullFromEternity-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ VoluntaryPullFromEternity ---
[INFO] Installing C:\Users\Roboverse\eclipse-workspace\VoluntaryPullFromEternity\target\VoluntaryPullFromEternity-0.0.1-SNAPSHOT.jar to C:\Users\Roboverse\.m2\repository\TromboneSMP\VoluntaryPullFromEternity\0.0.1-SNAPSHOT\VoluntaryPullFromEternity-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\Roboverse\eclipse-workspace\VoluntaryPullFromEternity\pom.xml to C:\Users\Roboverse\.m2\repository\TromboneSMP\VoluntaryPullFromEternity\0.0.1-SNAPSHOT\VoluntaryPullFromEternity-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.045 s
[INFO] Finished at: 2021-03-01T18:46:45-05:00
[INFO] ------------------------------------------------------------------------

这是我的 pom.xml:

<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>TromboneSMP</groupId>
  <artifactId>VoluntaryPullFromEternity</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.6.1</version>
              <configuration>
                  <source>1.7</source>
                  <target>1.7</target>
              </configuration>
          </plugin>
      </plugins>
   </build>
   <repositories>
       <repository>
         <id>spigot-repo</id>
         <url>https://hub.spigotmc.org/nexus/content/repositories/public/</url>
       </repository>
   </repositories>
   <dependencies>
       <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.16.4-R0.1-SNAPSHOT</version><!--change this value depending on the version-->
           <type>jar</type>
           <scope>provided</scope>
       </dependency>
   </dependencies>
</project>

【问题讨论】:

    标签: java eclipse maven


    【解决方案1】:

    输出显示

    Building jar: C:\Users\Roboverse\eclipse-workspace\VoluntaryPullFromEternity\target\VoluntaryPullFromEternity-0.0.1-SNAPSHOT.jar

    因此,如果您在目标中没有看到 JAR,您可能需要刷新 Eclipse。如果可以找到该文件,请查看 Windows 资源管理器(或某些 Linux 等效项)。

    【讨论】:

      猜你喜欢
      • 2011-04-26
      • 1970-01-01
      • 1970-01-01
      • 2014-05-19
      • 2012-01-14
      • 1970-01-01
      • 2012-01-12
      • 2020-08-24
      • 1970-01-01
      相关资源
      最近更新 更多