Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying to build with maven => package my.external.package does not exist

 
jean-gobert de coster
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I created a maven project and did some coding (yay) which required me to use some libraries that are in any maven repository (:sad

so I imported the .jar files of those libraries and did happily code without Eclipse complaining about anything (except for staying up too late).

then now I'm proudly trying to build my very first .war with maven, I run -> maven build... clean package and then I get a whole bunch of errors saying that

[ERROR]
Mojo:
org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile
FAILED for project:
myproject:search:war:0.0.1-SNAPSHOT
Reason:
/Users/me/Documents/myproject/src/main/java/com/mydomain/myclass/myController.java:[17,36] package org.someother.project.package does not exist

what is wrong? How can this be? I'm in despair, save my friday the 13th
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somewhere in your pom you are referencing org.someother.project.package, where is that?
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the contents of the myController.java file? Do you have this line:


 
jean-gobert de coster
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Johnson wrote:What are the contents of the myController.java file? Do you have this line:




more like



Somewhere in your pom you are referencing org.someother.project.package, where is that?


I'm not sure I can reference org.someother.project.package in my pom.xml, since that package is not a maven project, it's not in any repository.

my pom.xml looks like this:



What I did do, in the build path of the project, was to link the .jar in which org.someother.project.package is. So I have a symbolic link "lib" source folder in my project.

As I said, Eclipse doesn't seem to mind, however I noticed that I don't have any .class files generated (even though auto build is on).
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your pom.xml for the war project have the built jar as a dependency?
 
jean-gobert de coster
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martijn Verburg wrote:Does your pom.xml for the war project have the built jar as a dependency?


the pom.xml in my previous post is that of my war project
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, didn't have my coffee yet In that case you need to add in that 3rd party jar as a dependency in your pom.xml file.
 
jean-gobert de coster
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martijn Verburg wrote:Sorry, didn't have my coffee yet In that case you need to add in that 3rd party jar as a dependency in your pom.xml file.


Is it possible to add that as a directory or do I have to add all the .jar manually one by one?
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to add the jar manually, see for assistance, you'll need to install that jar into your local repository however.
 
jean-gobert de coster
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK will do

I didn't think of adding them to my local, that's brilliant (and simple) thanks
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll want to probably be able to do this as a long term solution (your local repo is temporary after all). Nexus and Artifactory are two highly recommended dependency managers to try.
 
jean-gobert de coster
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martijn Verburg wrote:You'll want to probably be able to do this as a long term solution (your local repo is temporary after all). Nexus and Artifactory are two highly recommended dependency managers to try.


Thanks for the input, I've hear of Nexus before and will definitely take it into consideration. My intent is to convince my boss and co-workers that maven is good for us, but I need to tame the beast if I want to present it
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds good! In that case I'd recommend reading the Free PDF - "Maven - Definitive Guide", it'll quickly get you up to speed (just google for it).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic