1

I am new to maven environment. In my project I need to use external jar which I have installed locally but while build compilation maven still searches intranet repo and fails the build compilation. In the logs I could see that it installs the external jar while doing make but when compiling(or may be when it comes to project pom and finds the dependency) it tries to download the same jar again from intranet repo and fails.

Here is the command I am using in makefile to install the jar locally,

$(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

Is there any way to force maven to look into local repo instead going online.

============

I tried solution given in Maven: add a dependency to a jar by relative path.... And not at least I am not facing jar download issue. But it is still failing to compile the build with the below error,

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) 

Is it still not finding the dependency jar?

Community
  • 1
  • 1
anirudha sonar
  • 131
  • 2
  • 14
  • 1
    post the error log + install log may help. – ben75 Apr 02 '13 at 20:59
  • I tried solution given in http://stackoverflow.com/questions/2229757/maven-add-a-dependency-to-a-jar-by-relative-path.... And not at least I am not facing jar download issue. But it is still failing to compile the build with the below error, – anirudha sonar Apr 03 '13 at 11:33

1 Answers1

3

Exception in thread "main" java.lang.NoClassDefFoundError: '-Xmx1024m

This means you have your MAVEN_OPTS environment variable defined wrong. Check if you have ' character in there and remove.

eis
  • 45,245
  • 11
  • 129
  • 177