• 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

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

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Somewhere in your pom you are referencing org.someother.project.package, where is that?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
reply
    Bookmark Topic Watch Topic
  • New Topic