I am trying to develop my application in different Eclipse Java projects where each will contain a certain feature. Then I want to combine them in one complete Java project.
However, I have a problem when linking the sources.
The sub-projects can correctly refer to parent-project classes but some of the source files that are accessed by the parent projects cannot be identified in the sub-projects.
I have a workspace/ParentProject/src/main/resources/file, where in the ParentProject I am accessing with "src\main\resources\" from within Java.
However, at runtime the ChildProject throws an exception that they cannot access the file : 'file:/E:/Eclipse%20workspace/ChildProject/src/main/resources/file'
So, when using a method of the ParentProject from the ChildProject, the classpath is somewhat transfered to the ChildProject. My question is how to resolve this.
I hope I made it clear what the problem is and will be really appreciative for any help.
Regards,
Petar
Btw: It is explained there How to link project in eclipse but I still have the error, that the child project cannot access resources accessed by the parent project.
Although I am not entirely sure what you need to do, it sounds to me that you are trying to create circular dependencies, which is an anti-pattern. You want to avoid creating dependencies where project a depends on project b, but project b also depends on project a. If you provide more details on your use case and what you are trying to create I will be happy to provide some guidance as to how you could structure your dependencies.
Hope this helps.
Right click the Parent project and click properties. Then click Java Build Path on the left hand side. Next click the projects tab. Make sure the Child project is selected as a required project, if it is not Add the Child project.
You should also do this for the Parent Project.
Related
I have a android app in eclipse, and by the time I have more and more classes in it.
As you can see, its pretty messy.
In visual studio I know how to add sub folders in the project, and organize the classes in a more ordered way (for example Interfaces folder, Client folder etc).
How can I do it in eclipse without messing with the namespaces or causing any errors? do I add packages?
thanks!
Yes, you need to create package inside of "com.example.tremp" by right-clicking it.
I think it should have a name including the parent package name (e.g. "com.example.tremp.activities"), but I have tried naming it without parent package name (e.g. "activities") and it worked fine by me.
I think the only way is to create new packages and then assign each class to a package .
I have multiple maven projects that are related to each other in Eclipse.
Now I need to check the projects e.g. for cyclic dependencies. What I have is a folder that contains the constraints in every single project.
Is there a possibility to check the rules (constraints) with jqassistant without putting them into a folder in each project ?
Maybe there is a way to define the rules in a root project and let the tool know which projects it has to search for.
thanks for help
Tino
PS: Sorry for my bad english :)
there's currently only one way to share rules between projects by creating a plugin, i.e. a JAR file containing rules.
The documentation provides examples for
The structure of such a plugin
How a plugin is used with jQAssistant.
Would that solve your problem?
There are a lot of similar questions, but none for this specifically. I have a Netbeans project with a bunch of packages. Only one has Main. I'd like to be able to create a .jar from just one of the packages (and all the classes it contains, of course), which doesn't have main.
Is this feasible without having to put that package in another project or without having to screw around with build.xml? If the latter, any easy way or good rtfm links?
The point is i'm developing part of an application for college, each group member is developing a module of sorts. If each could provide their .jar the main project can just include jars and use them. I'm guessing all the mains in the jars wouldn't really hurt? But still...
You can use the project properties to customize your project's jar file content. This screenshot shows what it looks like for a Java Class Library project.
I am working on an RCP application. Currently, I am stuck on trying to get the project created from my custom wizard to open the files in my CNF-based navigator. I am not really sure whether it needs to be done on the navigator-side or the wizard-side.
I came across a couple tutorials that put me on the right path. It turns out I needed a model for the project hierarchy and label/content providers.
http://cvalcarcel.wordpress.com/2009/07/11/writing-an-eclipse-plug-in-part-2-creating-a-custom-project-in-eclipse-adding-to-the-new-project-wizard/
http://cvalcarcel.wordpress.com/2009/07/26/writing-an-eclipse-plug-in-part-4-create-a-custom-project-in-eclipse-new-project-wizard-the-behavior/
http://cvalcarcel.wordpress.com/2009/10/18/writing-an-eclipse-plug-in-part-7-creating-a-custom-navigator/
I am using a kind of framework where every time I make a new Java project. I have to arrange the files in the appropriate packages and reference the appropriate external JAR libraries. How do I make a new project template like in the New Project dialog under a new folder?
I've just done a bit of research on this for our own nefarious purposes, and found the answer.
You need to create an Eclipse plugin that uses the org.eclipse.ui.newWizards package. You can define your own category or use an existing one once you find the category ID. To create a new project wizard rather than a new resource wizard, you need to set the "project=true".
Also, your plugin must contain a class that implement org.eclipse.ui.INewWizard. Clicking on the class link from the plugin.xml editor will do the trick.
That class must do all the work in the performFinish override, and must return true to indicate that it actually did its thing and the wizard can close. This is where you create files, directories, set natures, and so forth.
You need to write an Eclipse plugin for that, and concentrate on New Project Wizard.
Writing Eclipse plugins is covered in Stack Overflow question How to write a plugin for Eclipse?.