Configuring Eclipse CDT for Apache Mesos - eclipse

How do I configure Eclipse CDT Luna to work with Apache Mesos directly?
The steps for building Apache Mesos on a Linux machine are known and provided here:
http://mesos.apache.org/gettingstarted/

(This works on a Mac with Eclipse “Kepler”. I hope it is similar on other platform variants.)
Install Eclipse with CDT
“git clone” a Mesos git repository into a local directory as described in the “Getting started” guide you referenced.
Open eclipse. Select “File->Import…->Git->Projects from Git”.
Select “Existing local repository”.
Click on “Add…” and add your local Mesos git directory. It will show up in the list in the selector box from step 4.
Select the entry for your directory and click on “Next”.
Select “Import as general project” and click on “Next”..
Give your project a name and click on “Finish”. Now you have a project.
Make sure you are in the C++ perspective. Select/highlight your project in the Project Explorer. Then select “File->New…->Convert to a C/C++ Autotools project”.
Edit your project’s properties (Select project, Cmd-I). On the pane “C/C++ Build”, add “/build” to the value of “Build directory”. It should look like this: ${workspace_loc:/myProjectName}/build
Optional: In pane “Autotools” go to “Configure Settings->Advanced”. Under “Additional command line options” you can put “--disable-python --disable-java” if you don’t want to build Python and Java-related stuff every time.
—
As a prerequisite, I am using these values in my eclipse.ini (https://wiki.eclipse.org/Eclipse.ini):
-XX:MaxPermSize=512m
-Xms1024m
-Xmx6144m

Related

Associating a Project to Sonar in Eclipse

I have Eclipse Indigo 3.7 base with MyEclipse 10 Java enterprise development plug-in:
I have installed Sonar plug-in for eclipse.
Installed Sonar server and running it locally from localhost (localhost:9000)
Tested the Server connection in Eclipse from
Windows>Preferences>Sonar>Servers. Connection is successful.
For my Project, ran the Maven goal for sonar (sonar:sonar). Build is
successful. I am able to browse the results in localhost. (localhost:9000)
My issue is with Associating the project to Sonar.
When i right click on my project, Configure > Associate with Sonar, I get a screen where nothing happens.
Basically the screen has 2 fields,Project and Sonar Project.
The Project field contains the name of my Project and Sonar Project field lists this message - "click here to start searching for a remote Sonar project"
I click on that field and enter my groupid:artifactid but nothing
happens.
I also tried entering the Project Name listed in Sonar dashboard
but that also does not help.
When i right click on my project, In the context menu i am unable to see 'Sonar' option.
Help me associate my project to Sonar in eclipse. Please let me know what i am missing.
Thanks in advance.
I had the same issue with my Liferay project in Eclipse (liferay-plugins-sdk.6.2.0) and here is how I got it working:
Install the eclipse plugin, and test server connection
Install the Sonar server and start it (for example on yourhost:9000)
Go to yourhost:9000 and login (admin/admin unless you changed it)
Go to Settings -> System -> Provisioning
Create new project (+Create in the top right corner)
I've used key=Liferay6.2 and name=liferay-plugins-sdk-6.2.0
After the above steps I went back to my eclipse project and in Configure > Associate with Sonar I was able to search/find the liferay project.
When using Sonar Eclipse, you can associate Eclipse projects only to the corresponding Sonar modules (unless you are working on a single-module project, which is pretty rare in fact).
This means that you can't associate the root project (which is logical as by definition, a root project has no sources in Sonar). You have to right-click on all the imported Maven modules, and associate them all in a single run.
Go to your project folder in eclipse workspace from the terminal and run following command:
mvn sonar:sonar
This command will create your sonar project. Try associating the project again. Make sure you enter the name associated with your project from your
pom file. (Clear the text field)
BEST ANSWER AFTER SO MUCH ANALYSIS(I have faced the same problem)
Forget to add to associate with SonarQube first
If you want to add sonar group id create sonar-project.properties
Just add below code
# Required metadata
sonar.projectKey=javapractice
sonar.projectName=javapractice
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.sources=src
# Language
sonar.language=java
# Encoding of the source files
sonar.sourceEncoding=UTF-8
download sonnar-runner from github.
download sonar example from github
download sonar
run sonar as per your operating system from command prompt
go to sonar example path like c:/sonar example/java/.. /.. *.properties path (beside src)
run sonnar-runner c:/.... / sonnar-runner.bat -e
go to browser http://localhost:9000 after that (login:admin/admin)
your project is displayed in the browser.
Choose Maven on the project and then choose Select Maven Profiles and then choose with-sonar in Eclipse. This will enable the Sonar functionality on projects. Now you will see the Sonar option when you right click on projects.

Debug Solr code in Eclipse

New to Eclipse and Solr, I imported apache-solr-3.6.0.war into Eclipse and run Solr with tomcat plugin. Now i want to debug some existing code, however how do i import the Solr source code?
Without knowing how you imported it exactly: sounds like you are looking for Source attachment.
It might be better if you use the Solr source code directly. Check the README file included in the release, there is an ant task to init eclipse:
To setup your ide run [...] 'ant eclipse'.
Then all dependencies are loaded using ivy and you can run it from within the IDE.
You can also check out the whole Lucene/Solr source:
install Subclipse add-in
choose New... > Project...
SVN > Checkout projects from SVN...
add this link as new repository
select branch /branches/lucene_solr_3_6 (if you want last stable version. Use trunk if you want to use cutting edge source)
choose Check out as a project in a workspace and leave everything else default
Then, after the checkout completes, to complete setup, you don't have to fiddle with JARs manually, simply:
right click on main build.xml, the one in your project's root
choose Run As... > Ant build... select (in this order)
ivy-bootstrap and resolve tasks (which will download all JAR dependencies)
then run in this order: validate, clean-idea, eclipse, compile, get-maven-poms, generate-maven-artifacts (the last two only if you plan to use Maven).
And that's it, you should now see no redness in your workspace and have Lucene and Solr JARs built.
Run solr like this:
java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044 start.jar
Solr will start, but wait you to connect from Eclipse to continue.
Then in Eclipse, go to:
Run / Debug Configurations...
Select Remote Java Application
Press New button to create a new remote configuration
put 1044 on port
Click on Debug
This is the standard way to debug remote applications in Java
./solr start -p 8983 -f -a "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=0.0.0.0:8000"
Start solr with
provide app run on port 8983
provide Xrunjdwp:transport=dt_socket
remote ip address 0.0.0.0:8000
and then go to eclipse

No HTTP Preview server for Eclipse Juno in Ubuntu 12.04

I just installed Eclipse Juno on Ubuntu 12.04 (32-bit) and downloaded the Eclipse Web Developer Tools. I created a new Static Web Project but cannot create/use HTTP Preview for the Target runtime to test/run my project. Does anybody know whether this is possible? If so, how would I do this?
You can create the patch and make it work for the Eclipse Juno version you have in the following four phases. Its a bit lengthy but it works
Phase 1: Create a plug-in project for the plug-in you need to patch.
Create a new workspace (recommended) or open an existing one.
Select File -> Import
Expand Plug-in Development, select Plug-ins and Fragments, then click Next
In the Import As section, select Projects with source folders
and then click Next.
Enter (or copy & paste, no quotes)
org.eclipse.wst.server.preview.adapter into ID field at the top and
click Add All. This should move this one plug-in to the right pane.
Click Finish to import the "org.eclipse.wst.server.preview.adapter"
plug-in source into a project.
Expand the root of the project and ensure it contains a folder named
"src". You will only get the "src" folder if you have the "WST Server
Adapter Plug-in Developer Resources" installed.
Phase 2: Apply the changes needed to update the plug-in. Since there is a bug with a patch attached that can be used to apply the changes, the following steps will take advantage of that.
Open Bug 402848 in a browser.
Click on the Patch v1.0 for 3.4.2p attachment link to open the patch.
Starting with the second occurrence of a line starting with ---,
select this line through the end of the text and copy it to the clipboard. This contains the changes to the PreviewLaunchConfigurationDelegate.java file which is where the fix is
needed. You don't want the upper portion of the patch as that would change the version of the plug-in, and that would complicate things.
Back in Eclipse, right-click on the "org.eclipse.wst.server.preview.adapter" project. Select Team and click on Apply Patch.
Leave Clipboard selected and click Next.
Ensure the "org.eclipse.wst.server.preview.adapter" project is
selected, and click Next.
Set the Ignore leading path name segments to 3. The "Patch
Contents" window should change to have a blue left pointing arrow
instead of red x indicators.
Click Finish to apply the changes.
Phase 3: Create the replacement jar. Due to the approach in Phase 1, the name of this jar will be identical to your current jar, which simplifies updating the Eclipse installation.
Right-click on the org.eclipse.wst.server.preview.adapter project in the Project Explorer or other navigator view and select Export
Expand Plug-in Development, select Deployable plug-ins and
fragments, then click Next
Click the Browse button next to the Directory selection in the Destination tab followed by OK. This will set the output directory to be the same as your workspace.
Click Finish to build the replacement plug-in jar. It will appear in
a "plugins" folder under the root of your workspace.
Phase 4: Replace the installed plug-in jar with the fixed version.
Exit Eclipse if it is running.
Under the "plugins" folder of your Eclipse installation, move or
rename the org.eclipse.wst.server.preview.adapter_1.1.101.v20121107_1651.jar if you
don't want to overwrite it with the patched version (mentioned in step 3 below). If you have a different version, it means you aren't using Juno SR2 and hopefully you installed the "WST Server Adapter Plug-in Developer Resources" that matched your version.
Copy the org.eclipse.wst.server.preview.adapter_1.1.101.v20121107_1651.jar from
the "plugins" folder under your workspace and paste it to the "plugins" folder of your Eclipse installation.
You should be able to run Eclipse now with the fixed plug-in. Because the patched jar had the same version number, no additional changes are needed.
I'm not familiar with the tooling you're using, but I had big problems with eclipse's internal browser on 12.04 as it was trying to use mozilla's XULRunner. The packaging of XULRunner has changed in 12.04 due to mozilla's release cycle, and isn't included in the repo independently. I forced my eclipse to use WebKit, by setting the following property in the vmargs section of my config.ini
-Dorg.eclipse.swt.browser.DefaultType=webkit
This sorted my issues out - hope this helps with yours.

Setting up a cross-platform C++ project in Eclipse with cross-platform libraries

I am working on a cross-platform C++ project with 8 other people which uses the following libraries:
OpenCV Library
Boost C++ Library
The project is inteded to be cross-platform so all users have agreed not to use platform-specific code, and, to keep things as simple as possible, all users will be using Eclipse as their IDE. However, some will be using Eclipse for Windows while other will be using Eclipse for Linux.
Since the project will be hosted on SVN, we would like to avoid conflicts with different configuration files (like make files, eclipse project files etc..) which are shared. We would also like to share as much of the configuration files as possible through SVN, to keep the configuration as simple as possible.
Let's assume that all users have properly configured system variables and installed the required build tools (such as make, cmake etc.), and have configured their Eclipse settings configured properly (but not the project-specific settings).
How to configure the project once and what of the configuration files to share on the repository, so that both Windows and Linux users can compile it without modifying configuration files retrieved from the SVN repository?
(I am not looking for the complete solution which would specifically work for those 2 libraries I mentioned, so I would appreciate a general how-to step-by-step explanations which would enable me to easily add another library.)
General discussion:
You will need to install Cygwin or something similar to it to make GNU Autotools toolchain available to Eclipse on Windows:
How to deal with Eclipse CDT+Cygwin?
Once your toolchain, Eclipse, with CDT and SVN connectors are ready on your development machines, go through the following steps.
Open Eclipse and switch to CDT: Click Window->Open Perspective->Other... and select C/C++
Select: Eclipse->File->New->C++ Project
Project name: viewer
Select: Project type->GNU Autotools->Hello World C++ Autotools Project
Click: Next
Click: Finish
Right-click in Project Explorer: viewer->Reconfigure project
Click: Console->Display Selected Console submenu-># CDT Global Build Console. If "autoreconf -i" output is nominal, proceed to step 9. If Console reports: sh: autoreconf: command not found, then add the path to the autoreconf command to the Project Build Environment:
Right-click in Project Explorer: viewer->Properties->C/C++ Build->Environment->Add...
Name: PATH
Value: path_to_autoreconf:${env_var:PATH}
Click: OK
Click: Apply
Go back to step 8.
Double-click: Project Explorer->viewer->src->viewer.cpp
Add some code:
include <opencv/cv.h>
include <opencv/highgui.h>
include <cassert>
int main(int argc, char *argv[]) {
assert(argc > 1);
CvMat* img = cvLoadImageM(argv1);
cvNamedWindow("Picture", CV_WINDOW_AUTOSIZE);
cvShowImage("Picture", img);
cvWaitKey(0);
return 0;
}
Double-click: Project Explorer->viewer->configure.ac and enter the following code below AC_PROG_CXX.
AC_CHECK_LIB([opencv_core],[cvSetZero],[],[])
AC_CHECK_LIB([opencv_highgui],[cvShowImage],[],[])
AC_CHECK_LIB([boost_regex-mt],[regexecA],[BOOST_LIB_SUFFIX="-mt"],[BOOST_LIB_SUFFIX=""])
AC_SUBST(BOOST_LIB_SUFFIX)
Double-click: Project Explorer->viewer->src->Makefile.am and enter the following code.
>
bin_PROGRAMS=viewer
viewer_SOURCES=openCvFocusIssue.cpp
viewer_LDFLAGS = -lboost_regex#BOOST_LIB_SUFFIX# -lopencv_core -lopencv_highgui
Repeat step 8, autoreconf (Reconfigure project)
Click: Project Explorer->viewer
Build project by clicking the hammer in the toolbar. If you do not see the hammer, Window->Open Perspective->Other... and select C/C++. If C/C++ does not show up, install the CDT.
Click: Project Explorer->viewer and then Run->Run, then in the Run As window->Local C/C++ Application, then in the Launch Debug Configuration Selection window->gdb/mi and press enter. You should see Hello World.
Quit Eclipse and navigate to the viewer project directory.
On the command line, issue make dist
Ensure you got a viewer-1.0.tar.gz or similarly named file, and then remove it: rm viewer-1.0.tar.gz
On the command line, issue make clean
In the same place, issue make distclean.
Navigate to the workspace directory that contains the viewer project.
Move the entire viewer directory to the directory that contains the svn checkout you want to place the viewer project in.
Change directories to where you just moved the viewer.
svn add viewer && svn ci -m "Added eclipse-autotool project"
Open eclipse and make sure that you have an SVN connector installed.
Remove the "viewer" project from the Project Explorer view.
Open eclipse and add this SVN repository checkout to the Team perspective.
Import the viewer project from your SVN repository checkout.
Switch back to the C/C++ perspective and have fun.
Two suggestions:
Use cmake: I love this tool. There is a bit of a learning curve but
if you get it right all the project will include is the cmake files
and when a person first checks it out they run cmake to generate
their makefiles (or VC++ project files, etc) with all the different rules for linux or windows one
might need.
or
Check in a basic config for the project, then add those configs to the git/svn ignore so no one ever checks them in again, then when you checkout for the first time you have to get your config running but after that it won't be overwritten.

Adding eclipse jvm arguments to version control

In our eclipse project we have some jvm arguments that are required for the project to work. The project is connected to clearcase for version control.
How can we add the jvm arguments to version control so new developers will have them set up when they join the project (or have the rest of the team updated when someone makes a change)?
Thanks,
Alex
Where are theses JVM arguments needed? At the launch of Eclipse? For the compilation of your project?
If you need JVM arguments at the launch of Eclipse, you have to edit the "eclipse.ini file", at the root of your Eclipse installation folder.
If you need JVM arguments at compile time, you can customize them in Eclipse preferences.
You can add them to a launcher that you will:
export within your current version-control workspace
version
See where are the external tools launch configurations in Eclipse.
See also blog post "Tip: Creating and Sharing Launch Configurations"
Select the 'Shared file' option. Select the project to which this launch configuration belongs. I suggest the launch configurations to be saved at the root of the project directory.
have you tried adding it to your build.xml?
I would create lunch configuration that can be imported later on. First create a run/debug configuration, for successful run on your local pc. If it is team project this run configuration will be fine on others machines. Then export it: file->export-> run/debug->launch configuration and select correct one that you have created. Then you will get that exported to the file that can be kept under version control. To import it do file-> import -> run/debug -> launch configuration and select the file.