【发布时间】:2013-04-03 19:41:08
【问题描述】:
我是 Maven 环境的新手。在我的项目中,我需要使用我在本地安装的外部 jar,但是在构建编译时,maven 仍然搜索 Intranet repo 并且构建编译失败。在日志中,我可以看到它在执行 make 时安装了外部 jar,但是在编译时(或者可能是在项目 pom 并找到依赖项时)它尝试再次从 Intranet repo 下载相同的 jar 并失败。
这是我在 makefile 中用来在本地安装 jar 的命令,
$(MVNBLD) install:install-file -Dfile=jarName.jar -DgroupId=com.example.project -DartifactId=jarName -Dversion=1.0 -Dpackaging=jar -Dgenerate`enter code here`Pom=true -gs settings.xml
有没有办法强制 maven 去查看本地 repo 而不是上网。
============
我尝试了Maven: add a dependency to a jar by relative path.... 中给出的解决方案,至少我没有遇到 jar 下载问题。但它仍然无法编译构建并出现以下错误,
Exception in thread "main" java.lang.NoClassDefFoundError: '-Xmx1024m
Caused by: java.lang.ClassNotFoundException: '-Xmx1024m
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: '-Xmx1024m. Program will`enter code here` exit.
make: *** [prod_jar] Error 1
Command finished (error code: 2)
还是没有找到依赖jar吗?
【问题讨论】:
-
发布错误日志 + 安装日志可能会有所帮助。
-
我尝试了stackoverflow.com/questions/2229757/…....中给出的解决方案。至少我没有遇到jar下载问题。但它仍然无法编译构建并出现以下错误,
标签: maven