Configure Sonar and maven to analyse multilingual project - maven

I wonder if it is possible to specify different languages in the sonar-project.properties file to analyse, for example, both java script and xml, which are in the same folder?
Thanks for your help!
ADDITION
for example, I have the following project structure:
client
pom.xml
|
|-----UI
|-----pom.xml
|
|-----core
|-----pom.xml
In UI folder I have different types of files (js, html, xml) and maven java project in core folder. Can I aim sonar to UI folder so that it will check .js, .html and .xml files in this folder and subfolders recursivly? I tried to specify several languages (separated by comma) for one module, but that had no effect. Thanks!

Yes, this is possible. You can check out the following "web+Javascrip" sample project: https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/multi-language/multi-language-source-files-in-same-directory
Please not that there are some requirements on Sonar and Sonar Runner versions (described in the README file).

Related

How to convert alfresco ant based project in alfresco5 maven based?

I am using alfresco 4.1.3 having following project structure.
I am using the ant script to build project.
Now I want to convert this project into maven based alfresco5.
I have configured alfresco5 using all-in-one archetype and I am able to run it successfully. My questions are:
How can I convert my alfresco ant based project in alfresco5 maven based?
Do I need to add src files in repo or repo-amp?
Do I need to copy all share related files in share or share-amp?
Any help would be greatly appreciated!!!
Thanks in Advance.!!
That totally depends on the ant build setup. But one good guess is that you will have to put the files residing in the "Alfresco" folder of your old project into different subfolders of the repo-amp, and the same way around with the "Share" folder. Most files will go into those folders, you have to study the SDK-docs carefully to know into which folders the files will go. Depending of the nature of your extensions some files could go into the Share and Alfresco war-structure as well (additions to web.xml for example).
There are no "Swiss army knife" for that works for all cases here.
Good luck
Do the following things:
Create new project as maven project and provide group id (it's yours) artifact id as alfresco5 and version (ex:43.0.1-SNAPSHOT)
With this it creates maven based folder structure
src/main/java -> replace it with your src folder
3.src/main/resources ->add your Share, reference and Alfresco folders.
look at you lib directory..what ever .jar will be there you need to define it in dependencies under pom.xml
compile the whole project..if there are compilation errors then add required dependencies in pom.xml

SonarQube excluding files, directories, and generated code?

The code base I am working with has a lot of generated code. In addition, there are also some deprecated files that I would want to exclude from SonarQube analysis. I've read up the documentation and looked at some answers on here about that, but it does not help in my case.
I have a multi-module maven project. So I have multiple projects in my workspace that are all part of a large application. Say I want to exclude this file:
/home/username/workspace/com.mst.rtra.importing.message/bin/com/mst/rtra/importing/message/idl/parse/idlparser.java
I don't really know how to write this in the exclusions settings on SonarQube because of how long the filepath is. Also, what if I want to exclude another file, but from a different module, say :
/home/username/workspace/com.mst.rtra.interpreter.create/
I am confused about I should write this in the exclusions box in project settings. Should I write the absolute file path due to the multi-module nature of this project? Or is there some other convention used?
In addition, if I want to exclude generated files from analysis, I would need to put file:/generated-sources/ as I saw in another answer. However, after analysis, I can still view the analysis results of those files when I open up the project in SonarQube dashboard.
We use ant rather than maven, and an older version of the Sonar ant task at that. But what works for us is setting a sonar.exclusions property in our build.xml, which accepts wildcards for filenames. For example:
<property name="sonar.exclusions" value="**/com/ex/wsdl/asvc/*.java,**/com/ex/wsdl/bsvc/*.java"/>
That skips analyzing all the code generated from a wsdl file for two services. You ought to be able to do something similar for maven.

Eclipse Plugin project: manage external files

I'm developing a plugin for Eclipse (4.2 on windows) that uses a bunch of external files (batch scripts, xml files, ecc).
I'm asking if there is a good method to manage those files inside the project in order to:
keep all the plugin resources inside the project for version control in SVN
possibly have an automated plugin installation (including those files outside the plugin jar)
Edit: Can an additional "Feature Project" be a solution?
Instead of having a project I would manage two: one for the plugin and one for the "feature" that references the plugin and gathers the non-plugin data.
In that case, I see that eclipse "Features" have an "installation" section (in "feature.xml"). How could I specify for each "non-plugin" file the install path location?
I'm using nested projects for this.
Create a parent project that will contain everything. For each sub-project, deactivate the default location when you create it and select the parent project's root folder instead.
Here is an example: http://git.eclipse.org/c/tmf/org.eclipse.xtext.git/tree/
It doesn't have a .project file in the root but having one doesn't hurt.
Just remember to import the sub-projects before you start working on them. Otherwise, you and Eclipse might get confused.

how to make checkstyle ignore xml files in my application

i've configured my checkstyle plugin with customized checkstyle.xml and it works fine with the java classes but having a lot of warnings with the xml files can anyone suggest how to disable the check style from any xml file in my application.
thanks in advance.
I can think of two ways to do that:
You could suppress findings from non-Java files. This works very well inside and outside of your IDE.
If you are using Eclipse, you can also configure Eclipse not to feed the non-Java files to Checkstyle. In order to do that, right-click your project and click Checkstyle. Uncheck use simple configuration. Specify a file set using \.java$ as regexp. You will see the list of files in the bottom half of the dialog window change to only Java files.
In earlier versions of Checkstyle, I think I remember that there also was a file name filter in the configuration XML, but I can't seem to find it in the docs now, so maybe that feature is no more.
There is a basedir property at the start of the Checker module in the check style config file. Uncomment it if it is commented.
Set it's value to the folder you want to apply your checkstyle rules to.
E.g. src folder of any eclipse project only contains java files.
<!-- If you set the basedir property below, then all reported file names
will be relative to the specified directory. See http://checkstyle.sourceforge.net/5.x/config.html#Checker -->
<property name="basedir" value="/MyEclipeProject/src"/>

IntelliJ automagically mark a target sub directory as "source"

I use IntelliJ since a few months back now for my Java development. I using IntelliJ as IDE and build my projects using Maven. A couple of my Maven projects generates code which my other Maven projects depends upon, the generated code ends up in a target/src-generated directory with "Maven-subdirectories" main/java, main/resource etc. Is it possible to make IntelliJ automagically mark the target/src-generated/main/java directory as source?
Thanks in advance.
Please refer to the IntelliJ IDEA Maven FAQ:
In order to get generated sources automatically imported as source
folders configure corresponding plugins so that they put them into
target/generated-sources/<subdir>, where subdir is any folder name you
prefer. The subdir folder is necessary to distinguish sources from
different tools and also to exclude some special generated sources
(e.g. groovy stubs).
Please note that even if you manually configure
some source folders under target/generated-sources of this folder
itself, IDEA will rewrite them according to your pom.xml.
Any time you
want to generate sources you simply execute the corresponding goal,
bound for generation (usually generate-sources,
generate-test-sources). After that IDEA will pick up new folders and
set them up. Generated test sources/resources should be placed in
target/generated-test-sources/<subdir>.

Resources