using eclipse, java maven project compiles but gives error when running -
there large number of answers error i'm getting, each of solutions i've tried (that understand @ least) have not solved problem.
project layout in eclipse looks this:
mavenproject1
src
resources
etc.
mavenproject2
src
resources
etc.
mavenprojectx
src
resources
etc.
each project compiles , runs fine. i'm trying use 1 of projects, of code in mavenproject2, in mavenproject1. i've updated build path , information can import mavenproject2 mavenproject1 , reference methods want.
reference mavenproject2 method in mavenproject1 enumerates , doesn't give error in editor (i.e. com.mavenproject2.method()), , mavenproject1 compiles. when try run it, error below. i've tried fixing classpath (as understand it, wrong), i've tried adding project, external jar, every option, in run configuration project, keep hitting same error on line in mavenproject1 calls method in mavenproject2.
[warning] java.lang.reflect.invocationtargetexception @ > sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ > sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ > sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ > java.lang.reflect.method.invoke(unknown source) @ > org.codehaus.mojo.exec.execjavamojo$1.run(execjavamojo.java:297) @ > java.lang.thread.run(unknown source) caused by: > java.lang.noclassdeffounderror: com/mavenproject2/method_from2 @ > com.mp1.mp1.main(capi.java:154) ... 6 more caused by: > java.lang.classnotfoundexception: com.mavenproject2.method_from2
when first build projects current project depends on, make sure stored in local maven repository. when add dependencies project's pom.xml should resolve build.
Comments
Post a Comment