Is there a way to restrict the project drop down list when you bind an Eclipse project to a SonarQube project? - eclipse

My Eclipse project is made up of about a dozen smaller projects.
My SonarQube dashboard shows the main project followed by the subprojects with a single line separation. They all share the same name, but hovering over the name will show the main project or the subproject (two hover examples) .
In Eclipse, when I want to bind my project, the list provided from the SonarQube server (Eclipse bind options screenshot) includes all the subprojects, but they all have the same name.
Is there a way to only show the main project in the bind list or have the subproject name be easier to find both in the bind list and the sonarqube project view?

Currently that's not possible, but it's a good idea.
We plan to implement it and I've created a ticket to track this feature, that you can follow/vote: https://jira.sonarsource.com/browse/SLE-94

Related

Project Specific Tasks - Eclipse

I am trying to create a task via the task view in eclipse for a specific project. However when changing projects the tasks stay the same.
Is there any way to differentiate between the projects.
This is my current list to a work project, I do not want this PHP work project to be shown in my learning c* project(s) :
Eclipse's Mylyn can do this (and a lot more). It's included in most of the recent Eclipse downloadable packages.

Project setup: Having one web project depend on another

I would like to have two "Dynamic Web Projects" in Eclipse. One basically "extends" the other so I would like to define the second as having access to the code and the JARs of the first.
Is this possible in Eclipse? If so, how?
In the "Java Build path" of the second project, in the "Projects" tab I have included the first project. In the "Java Build path" of the first project, in the "Order and Export" I have marked that its JARs etc should be exported. Compilation works fine.
When I deploy the second project, it cannot find any of the JARs or the code of the first project. If I go to "Deployment Assembly" of the second project and add the first project, it inserts "WEB-INF/lib/first.war" into the deployment assembly; this isn't very helpful, a WAR doesn't belong there. I see no other way to add compiled code and JARs from the first project into the deployment of the second.
What do I do?
I think what you want to do is to open the plugin.xml of the project you want to add the dependency to. On the dependencies tab you can add the project you it needs to depends on. I think this will keep you going.
Regads

In Eclipse, how do I exclude test folder of one maven project from another project that has as a dependency?

I have two maven projects imported into Eclipse in the same workspace. Both have a class with the same name and package, but different implementations and in different locations in each project. Let's call this class com.namespace.Factory
Project A has Factory under its test folder, i.e: /src/test/java/com/namespace/Factory.java
Project B has Factory under its main source folder, i.e: /src/main/java/com/namespace/Factory.java
There is also a Project C which is dependent on both. Project C also uses Factory from Project B for some of its unit tests. Problem now is Eclipse can't compile Project C because it can't differentiate between the two Factory classes. If I build all projects in command line, they don't have issues.
You would think that Eclipse would ignore the Project A Factory class since it is in test.
I am using the m2e plugin. My current work around is to setup m2e to not resolve Project C's dependencies within the workspace. This forces it to download the jar that will not have test in it. However, this means I have a change in either A or B, I have to manually install A or B push the latest jar to the local repo, and update Project C's dependencies to pull down the latest jars.
Is there a way to exclude the Project A test folder from the build path in Project C so that I can continue resolving everything within the workspace? It feels like Eclipse is breaking something that is fundamental to maven projects.
I think you're just another user affected by the upstream bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=376616
To sum it up, the bug report discussion includes:
JDT implements just one buildpath per Eclipse project. This is very unlikely to change, since this was fundamental design choice and many APIs and implementation details rely on that.
Well, but that doesn't really answer your question I guess.
So I see multiple options here, depending on how much influence you might have on the projects:
either try to rename one of the classes => names would be unique
or if the classes contain basically the same functionality, play with dependencies between projects, or even create new one, that the other 2 would depend upon
that's pretty much what comes to my mind right now
Perhaps you can try this:
In project A's Properties dialog (get there by right clicking the project and then click Properties),
click Deployment Assembly on the left.
Eclipse will show all source folders.
Select the test folder (/test) and click Remove.

Setup a Eclipse Workspace With One Dynamic Web Project and Multiple Java Projects

Can someone guide me to setup a web app project in Eclipse. I want to have a Dynamic Web Project and multiple Pure Java Projects. My Web project will contain JSPs and Java projects will contain Struts Action classes, Spring Bean, Hibernate Entities etc. I want to use those Java Projects as dependency to the WAR. I have done work in such environments, but haven't setup a workspace from the scratch. Can you please guide me or share a link?
Note: I want to use Apache Tomcat or Glassfish as server
In every project you can set the JavaBuild Path properties.
So suppose you have project1 that is dependent on project 2 and some other libraries provided as jars. Go to that option for project1, choose tab Projects and add project2 (that of course is already a eclipse project), than go to tab Libraries and clic on Add external jars.. You are done. This is not dependant by the nature of the project.
Specifically, since you have a Dynamic Web Project, you'll need to go also to Deployment Assembly and add project2 and your jars to the list of files needed by the server.

How to get peer project source in eclipse and maven

creating a parent project with only a pom.xml, and lots of sub projects such as:
my-web
my-core
my-backoffice
etc. is easy, and the sonotype eclipse plugin does most of the work.
However, getting one project to know about the source in the other project seems to be hard. E.g. when you are debugging the my-web project, and step into my-core, eclipse doesnt know where to get the source.
Looking in the Java Build Path in eclipse, the maven plugin has added my-core as a folder under "Web App Libraries". I.e. its not using the my-core-0.0.1.SNAPSHOT.jar or similar, its using the raw java files. Great!
But how to tell maven to tell eclipse to look for the source in the same place?
Im not really sure where to start. Im guessing its possible to get maven to put the source in a special jar using the maven-soure-plugin, but this will usually be out of sync with the actual java files which the web project seems to be using directly.
A quick and dirty solution is to manually Edit the Java Build Path for each project, and add my-core and other dependant projects in the "Projects" tab. Is this best practice? Any other suggestions?
A quick and dirty solution is to
manually Edit the Java Build Path for
each project, and add my-core and
other dependant projects in the
"Projects" tab.
If this doesn't happen automatically you have a configuration problem.
My Guess would be that you have a version mismatch between the pom dependencies and the actual project versions. Or your projects have an unusual name template (m2eclipse resolves projects by their artifactId AFAIK)
Either way, what always helps is in your Debug configuration (Run > Debug Configurations ...) select the Source tab and just Add... the selected projects.