Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Declared package does not match expected package
Declared package does not match expected package [message #873438] Fri, 18 May 2012 08:38 Go to next message
Stefan Langenmaier is currently offline Stefan Langenmaier
Messages: 9
Registered: April 2012
Junior Member
Hello everybody,

I'm trying to use eclipse for a multi language project. The project structure already exists and is used in a build system. So it would only be possible to change the project structure with great pain. The current setup is similar to the following:

com.example.product1
com.example.product1.client
com.example.product1.util
com.example.product2
com.example.product2.client
com.example.product2.util

So there is one folder /com/example under which all products reside. The product1 and product2 folders not only have the mentioned sub-folders but also other folders for different source code and miscellaneous stuff. The developers only want to open their specific product where they work on and also the builds are specific to one product. So I created a project in the folder /com/example/product1 but when I specify the sub-folders in product1 as source folder the first line is marked red in eclipse with the error "Declared project does not match expected package". This seems logical as it does not see the root of the packages hierarchy. Is there some way to tell eclipse that it should look above the project? Can this check be ignored somehow?

I hope it is possible to understand my problem.

Thanks in advance
Cheers
Stefan

[Updated on: Fri, 18 May 2012 08:39]

Report message to a moderator

Re: Declared project does not match expected package [message #873624 is a reply to message #873438] Fri, 18 May 2012 17:31 Go to previous messageGo to next message
David Wegener is currently offline David Wegener
Messages: 1344
Registered: July 2009
Senior Member
On 05/18/2012 03:38 AM, Stefan Langenmaier wrote:
> Hello everybody,
>
> I'm trying to use eclipse for a multi language project. The project
> structure already exists and is used in a build system. So it would only
> be possible to change the project structure with great pain. The current
> setup is similar to the following:
>
> com.example.product1
> com.example.product1.client
> com.example.product1.util
> com.example.product2
> com.example.product2.client
> com.example.product2.util
>
> So there is one folder /com/example under which all products reside. The
> product1 and product2 folders not only have the mentioned sub-folders
> but also other folders for different source code and miscellaneous
> stuff. The developers only want to open their specific product where
> they work on and also the builds are specific to one product. So I
> created a project in the folder /com/example/product1 but when I specify
> the sub-folders in product1 as source folder the first line is marked
> red in eclipse with the error "Declared project does not match expected
> package". This seems logical as it does not see the root of the packages
> hierarchy. Is there some way to tell eclipse that it should look above
> the project? Can this check be ignored somehow?
>
> I hope it is possible to understand my problem.
>
> Thanks in advance
> Cheers
> Stefan
If you try and keep the project at its current location, you could
probably do something with linked folders, but you might run up against
problems because they overlap with your project.

My suggestion would be to create the projects up at the top of the
hierarchy and use the source folder exclusion filter feature to ignore
the other products files. This may not work for you since you probably
want to create two projects and projects can't overlap.

However, you could combine linked folders with source folder exclusions
by creating your projects outside the hierarchy and linking the root of
your source files into the project. Set exclusion filters to block out
the other projects files on the linked source folders.

If you use relative links (drag and drop the folder onto your project
from your systems file system explorer) or setup a Path variable.
Re: Declared project does not match expected package [message #874643 is a reply to message #873624] Mon, 21 May 2012 10:01 Go to previous messageGo to next message
Stefan Langenmaier is currently offline Stefan Langenmaier
Messages: 9
Registered: April 2012
Junior Member
I'm already experimenting with linked folders and noted the "problem" with overlapping into the project. But it looks like it brings me further.

I will try to look into your suggestion with the exclusion of source folders.

Thanks very much for your hints.
Re: Declared project does not match expected package [message #882859 is a reply to message #874643] Thu, 07 June 2012 10:33 Go to previous message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
On 21.05.2012 12:01, Stefan Langenmaier wrote:
> I'm already experimenting with linked folders and noted the "problem"
> with overlapping into the project. But it looks like it brings me
> further.
>
> I will try to look into your suggestion with the exclusion of source
> folders.
Note that you can also exclude whole resource trees via resource filters
on a folder. Also, if you have complex structures that you want to map
into an Eclipse project, then virtual folders might be handy.

Dani
>
> Thanks very much for your hints.
Previous Topic:Could not find or load main class
Next Topic:Re: Using JUnit @Rule with Eclipse's test runner
Goto Forum:
  


Current Time: Thu Oct 23 13:13:08 GMT 2014

Powered by FUDForum. Page generated in 0.02432 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software