Eclipse使用Maven构建项目运行main方法报ClassNotFoundException
maven
Maven: Apache Maven是一个开源的项目管理和构建工具,主要用于Java项目。适合需要自动化项目构建和依赖管理的开发者。特点包括约定优于配置、易于使用和社区驱动。
项目地址:https://gitcode.com/gh_mirrors/ma/maven
·
今天下午在搭建SpringMVC,然后使用了一段时间没用过的Maven构建。
首先是回顾了下Maven,但是照着网上写的一个写个例子程序一直报ClassNotFoundException错误。
<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>asdd</groupId>
<artifactId>wsadsfasdf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies>
</project>
import org.apache.commons.lang3.StringUtils;
public class CheckNumeric {
public static void main(String[] args) {
String text = "0123";
boolean result = StringUtils.isNumeric(text);
System.out.println(text + " is a numeric? " + result);
}
}
一直报:ClassNotFoundException异常。
明明Maven Dependencies下面已经有commons-lang3-3.3.2.jar,但是还是找不到类。重新配置maven,重启电脑都试过。就不知道问题出在哪里。
后面去找maven下载的目录,发现了奇怪的事情。jar包没下到,而是有commons-lang3-3.3.2.jar.lastUpdated这样的文件,瞬间蛋碎。
删除文件夹后,重新启动eclipse,这次成功下载到jar包。正常运行。
不知道踩什么坑了。
Maven: Apache Maven是一个开源的项目管理和构建工具,主要用于Java项目。适合需要自动化项目构建和依赖管理的开发者。特点包括约定优于配置、易于使用和社区驱动。
最近提交(Master分支:1 个月前 )
6e30ae66
The previous implementation cached field accessibility state globally,
which could cause issues when the same field is accessed from different
contexts or security managers. This was particularly problematic in
plugin unit tests where fields would remain accessible after being set.
The fix ensures that field accessibility is properly restored to its
original state after setting field values, preventing accessibility
state from leaking between different bean instances.
Added unit tests to verify:
- Field accessibility is restored after setting values
- Multiple field accesses don't leak accessibility state
- The fix works correctly across different bean instances
This resolves the issue reported on the dev list regarding compiler
plugin unit test failures related to field accessibility.
22 小时前
001c86bb
Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.5.20 to 1.5.21.
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.20...v_1.5.21)
---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-classic
dependency-version: 1.5.21
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 2 天前
新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。
更多推荐



所有评论(0)