This compilation unit is not on the build path of a Java project.

2,207 views
Skip to first unread message

Kenneth Wilhelmsen

unread,
Nov 29, 2011, 4:23:13 PM11/29/11
to PlayN
Hi,

I'm having a problem when editing the demos or trying to use the
library. I'm using Maven and Eclipse. Everything (ie. the showcase
demo) compiles and runs fine and I've been able to build and run as
both Java and HTML5. In general, I followed the Getting Started guide.

It might also be worth mentioning I'm quite new with both Maven and
Eclipse, but an quite experienced developer in general. Just different
languages and platforms.

Anyways, it seems to me Eclipse or Maven isn't able to dig into the
references and expand the code completion and I'm sure this is a
Eclipse/Maven problem and not with the library itself. I've done some
searching online and tried understand/solve the problem myself, but at
no avail.

This code will compile just fine, however while typing
assetManager()., graphics(). etc will throw off the message "This
compilation unit is not on the build path of a Java project."

public void init() {
// create and add background image layer
Image bgImage = assetManager().getImage("images/bg.png");
ImageLayer bgLayer = graphics().createImageLayer(bgImage);
graphics().rootLayer().add(bgLayer);
}

Any suggestions on how to resolve this?

tmjee

unread,
Nov 29, 2011, 5:58:45 PM11/29/11
to PlayN
Chances are we've got a build path issues here, guessing the app might
not have reference to PlayN.

Try mvn eclipse:eclipse to regenerate settings for your eclipse
project, might help.

Kenneth Wilhelmsen

unread,
Nov 29, 2011, 10:45:00 PM11/29/11
to PlayN
Thanks for the suggestion, it pointed med to the right path. I found
out what the problem was; working in the wrong project/directory. I
should probably dig deeper into the documentation before jumping into
coding. Lesson learned. :)

I created a project called "footest" and the following were created:
- footest
- footest-android
- footest-core
- footest-html
- footest-java

I went on trying to code in footest, and not the footest-core (subdir
src/main/java) which contains - as expected - the proper references.
I'm guessing this is the right place to do the work. Everything seems
to be working as it should. Java, Eclipse, Maven and the sorts isn't
exactly my daily development environment I'm not quite sure what's
what yet. Now I'm off spending a significant amount of time reading up
some documentation.

Thanks again!

Reply all
Reply to author
Forward
0 new messages