我正在使用 Maven,当尝试将其转换为 jar 文件时,它说构建成功,但它说没有要编译的源。
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building UrbanAC Booking Manager 1.2.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ UrbanAC -- -
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 24 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ UrbanAC ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ UrbanAC ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Akhil Maganti\eclipse- workspace\New\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ UrbanAC ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ UrbanAC ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ UrbanAC ---
[INFO] Building jar: C:\Users\Akhil Maganti\eclipse-workspace\New\target\UrbanAC-1.2.1-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.413 s
[INFO] Finished at: 2017-11-11T00:19:22+00:00
[INFO] Final Memory: 11M/245M
[INFO] ------------------------------------------------------------------------
最佳答案
Maven 需要固定的项目结构。
src/main/java - Application/Library sources
src/main/resources - Application/Library resources
...
https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
您需要将源文件移动到 src/main/java/...
这是需要的,因为maven不知道你可以在哪里保存*.class文件,maven尝试在“src/main/java”中查找,但没有找到。
这个结构是契约的
关于java - Maven:缺少 'target' 文件夹下的已编译类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47233083/