java - Maven:缺少 'target' 文件夹下的已编译类

标签 java maven

我正在使用 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] ------------------------------------------------------------------------

这是显示的错误,我不知道为什么会显示此错误。 enter image description here

最佳答案

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/

相关文章:

java - Spring Java 配置 - 如何创建枚举映射到 beans-references

java - scala maven 插件没有将 scala 文件打包到 jar 中

java - 无法启动 OSGi 包,缺少 com.ibm.uvm.tools

java - 使用 Java 构建工具

java - 我运行应用程序时强制关闭?无法开始 Activity

java - "text"和新字符串 ("text"有什么区别?

java - Eclipse E4 - UIEvents Mpart 关闭/打开

java - Spring MVC 或 Spring Boot 可以与 Amazon Alexa 配合使用吗?

java - Java如何知道依赖jar在哪里?

java - httpservlet 参数为空