Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Ant, Maven and Other Build Tools and the fly likes Classpath jars not picked up in mavenised projects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Classpath jars not picked up in mavenised projects" Watch "Classpath jars not picked up in mavenised projects" New topic
Author

Classpath jars not picked up in mavenised projects

Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Hi All,

I am placing a jar on the classpath of my Mavenised Project, but it seems to be not picking the jar.

In case of mavenised projects, can't I place jars on classpath explicitly.

Regards,
Ashwin


Ashwin Sridhar
SCJP | SCWCD | OCA
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

Exactly what do you mean by "placing a jar on the classpath of my Mavenised Project"? With Maven, you don't place JARs anywhere; instead, you add dependencies within your pom.xml.


JBoss In Action
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Thanks for your reply Peter.

I work on Eclipse and I placed the jar in the build path. But I found out that I need to specify the jar as dependency in pom.xml.

But I have one question, what would be the group Id, artifact Id etc as I created this jar in my local system.

Regards,
Ashwin
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

Since you create the JAR, that information (also known as the artifact's coordinates) is up to you. Did you create it using Maven? If so, you have already the coordinates. If you did not use Maven, it might be best if you did, then you can build the jar using "mvn install" and then reference it in your project. (If you insist on not converting it to Maven, you can still use "mvn install:install-file" to load the jar into the local repository; you would given the coordinates as part of that command)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Classpath jars not picked up in mavenised projects