• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

dependency scope compile

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi every body,

in pom of a project, i have added dependency with scope compile . which is a jar file which contains some class file and jar's as well. my current java file needs internal jars of dependent jar to compile.

But maven compile goal returning compilation error .

All the jar's needed to compile are in the single jar file which is added in dependency.............................


Please help me!
my pom
=======


Please Help ME!!!


Advance Thanks
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jars within jars are not part of the compiler search path, just as they are not part of the runtime classpath unless you add custom classloader code.

So in order to get the internal jars to be seen when maven runs the compiler, you need to extract them and add them to your repository as independent artifacts. It really doesn't have anything to do with scope.
 
Phani.Kiran Gutha
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim,

I have another question, i have multimoudle project one second modules needs first modules classes to compile..

How can i solve this.

Please help me

Advance Thanks
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's pretty much standard.

What you do is make a POM for each of the compiler dependencies (jars) that allows that particular library to be compiled and installed in your repository.

Then make a master POM whose dependencies are all the jars you built plus the compile target for whatever your main project is. Running Maven against the master POM will cause it to recurse into the dependencies if/as needed.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic