Command line build for Eclipse - dependent projects - eclipse

I am using an Eclipse based IDE (QNX Momentics.) I have several projects in my workspace. I have Project A, B and C. Project C has dependencies on Project A and B. If I go into the IDE and properties of "C" and Project References, and I check A and B, then I can go and do a "build" of C, and it will build A and B if they aren't already built. This works fine in the IDE. If I do a clean, and go out to a command line, and do a "make" under the C project, then it does not compile A and B, and thus gives me some errors. (can't find certain library files). I see a flag that has "A" and "B" projects in the .project file, but I don't see any rules anywhere to instruct it to build. Any help on this is appreciated. By the way, this is a C++ project if that matters.

I can build referenced projects whereas they are cleaned. I suppose your C project is a makefile project. So, it may change the behavior of the IDE.
Momentics creates a runtime makefile for "QNX C/C++ Project" type. Therefore, you cannot see all rules.

Related

Eclipse: Building both C++ and C files

Eclipse: Juno on Ubuntu 13.04
I'm trying to build a Clang project under Eclipse. I got and installed the llvm4eclipsecdt add-in and it works, I guess (it does compile to object files).
My problem is that I have a mixture of C++ and C source files (.cpp and .c extensions), and when I create a new C++ project, all the cpp files are included, but not the C files. And vice versa if I create a C project.
I'm thinking what I actually want is a C++ project and tell the C++ compiler to build the C files.
However, I have a lot of C files in my project, and I don't want to manipulate each one by one to tweak their build options or whatever.
Is there anything I can do project-wide to say "Yeah, I know this is a C++ project. Go ahead and compile the .c files too?"
Thanks!

eclipse: build path with other projects, how to prevent test src from being included?

in eclipse, I have project A, which depends on another project B.
now I add B to the build path of A. but since separately I need to run junit tests on B, I have the src/test/java and src/test/resources of B in the build path for B too. so when B is included in A's path, these src/test code is also included into A's path. this causes a lot of conflicts: for example, I declare the beans with same names in both projects, they have conflicts.
I know I can use m2eclipse plugin, but in many cases, my pom has special pre-compile plugins, so m2eclipse does not recognize these, and fails. so I have to do mvn eclipse:eclipse and generate a "regular" eclipse project , and work from there.
thanks!
Yang
Source folders are automatically exported to dependent projects, so I think you're going to have to factor the B project test packages to another test project that depends on the original project B.
Ugly, but I can't think of another way to do it.

Eclipse can't resolve transitive dependency projects?

In a Java project in Eclipse, I am trying to debug project A.
Project A has a dependency on B.jar, normally B.jar comes from my .m2/repository.
but now I want to make some temp changes to B's code, and have it reflected in A,
so I directly edit the source code in B project in eclipse, and set B as a dependency project in A's build path. Additionally, both A and B refer to C.jar as their dependencies.
This builds A fine, but when it is run, A's classpath contains 2 copies of all the classes and resources in C.jar. this creates a problem for those hibernate hbm.xml mapping files in C.jar and I got errors saying duplicate mapping for...
This looks to be a defect in eclipse, in that it lacks the resolution ability as maven posseses. is there a way to work around this? (apart from building B and installing to .m2 instead of having it as a dependency project)
Thanks
You mentioned "[setting] B as a dependency project in A's build path" - do you mean editing eclipse's build path or editing the project's POM? I'm guessing the former, in which case make sure that you have the latest version of the m2eclipse plugin installed and that both projects A & B are Maven eclipse projects. If it is set up correctly then your projects should look have an 'M' on their project icons, and the icons of any workspace dependencies should look like folders.

Eclipse link web projects java build path

In Eclipse have a java web project and I want to link it to another java project. Saying that:
Project A: Web project
Project B: Another java project
Normally can you achieve it by going to the properties of project A -> Java build path -> Projects and add the project B.
However if project A is a web project running inside tomcat then at runtime I receive a ClassNotFoundException for the classes of project B.
One solution to to problem is to export project B as a jar file and use it inside project A (put it in the WEB-INF/lib directory).
However this is not the case because I want also to debug at the same time project A AND project B
Go to Project A's Deployment Assembly property page and add Project B as a project Directive Type.
Eventually I found one good solution.
In eclipse from the properties of project A go: Java Build Path -> Source -> Link Source
in the "linked folder location" give the src folder of project B and in "Folder name" just put "src2" (just something different from "src").
This way eclipse creates a symbolic folder src2 which links classes of project B to the space of project A.
After that everything works fine:
You can compile and run project A without any ClassNotFound Exception.
You can debug classes from both Project A and project B at runtime.
Classes from project B are kept in a separate folder in the filesystem totally independent (this is also useful when you use a source control system like SVN, because two projects continue to be independent). Notice that even folder "src2" is not a real one, so no change in project A.

cmake, add_subdirectory without adding it to the generated project file?

I have a project that is build with cmake. In my cmakelists I have a
add_subdirectory(externals/foo)
to build the dependency "foo" which has it's own cmakelists.
Now it is so that also the whole foo sources and headers are included in the generated Project file (I'm using Eclipse). But all I want is to only have my project available in Eclipse (Eclipse has problems with subprojects in the same folder structure).
So that the cmakelists from "foo" is only used to build "foo" automatically and link it to my project. I don't want to see it in my IDE however.
Is this possible? If yes: How?
When I use Eclipse with CMake, I create the Eclipse project manually (with the New Project wizard) and for CMake I use the standard makefile generator. It requires a little extra setup: you need to set the build directory in the project properties if you're doing an out-of-source build, and I usually set the build command to make VERBOSE=1.
I'm not sure since I haven't used the Eclipse generator(s), but for the lack of a better solution, perhaps this method would solve your issue, since it gives you more control over the Eclipse project.
No, how should the ide know what to compile if you don't tell it what to compile? If you don't want to have the project in you project file, just don't add it.
Just compile the external lib by itself (use "cmake externals/foo") and then add the libraries in your project's CMakeLists.txt with
target_link_libraries(your_project externals/foo/bin/foo.lib)