Can we run SonarQube on a Maven1 project? - sonarqube

We have some old Maven1 project (we cannot upgrade it to the latest maven versions) so I am just trying to understand if there is a way we can run SonarQube on Maven1 version projects..?
If not what is the best alternate to analyze the code quality other than SonarQube?

Modern Maven projects are easy to analyze using the specialized scanner for Maven: it discovers the necessary configuration from Maven's metadata, most notably, the sources, test sources, compiled Java bytecode, and additional information that can improve the quality of the analysis, such as library dependencies.
Without such specialized tool that makes the configuration easy, you can always fall back to the most primitive scanner tool, the SonarQube Scanner CLI.
Using this tool, you can certainly analyze a Maven1 project, you just have to configure it correctly. This may not be very convenient, but certainly doable. Start with something simple, follow the error messages to get it working, then follow the warnings to get it working well.

Related

Continuous Integration terms and definitions (TeamCity)

So I am new to the continuous integration world and of course, like everyone else, have been thrown into the task of setting it up and integrating it.
My company is .NET based and handles MVC applications, regular websites, form applications, as well as windows services. We have a ton of solutions in our repository and most of these solutions have trouble building in our CI that I am testing out (TeamCity). My local PC being the testing server.
Anyways, I have been reviewing a ton of documentation regarding TeamCity on their confluence pages but a lot of it is very technical and I'm getting tired of reading things more than once. So with that being said, there were some terms and concepts that I was a little confused on that I was hoping someone could explain pretty plainly maybe with an example.
Build Parameters -
I understand what parameters are and know what they are used for. Why would I use one in a build?
2.Snapshot dependencies -
What are these and When should I use them? I am having trouble visualizing this.
Artifact Dependencies -
I understand what artifacts are, I don't know why a project would need them to build however.
Any input would be greatly appreciated. Thanks guys.
I could give you some examples.
Build Parameters
It gives you a way to configure your build. For example, you may want to control your build version in Teamcity. You can use build parameters to specify major, minor version (with default value) for your build.
Personally, I try to avoid to use it as we should control configuration in source code or somewhere.
Snapshot dependencies
It is mostly used to build a chain of builds. For example, you have two builds. One is building source and other one is deploying to development environment. If you want to trigger deployment build after each source code build is successful, you need to add snapshot dependency to deployment build.
Artifact Dependencies
The same example as above, you want to deploy the artifact build in other build. In this situation, you need to use artifact dependency to copy the artifact into deployment build to upload somewhere etc.
Or sometimes you may have different projects, some projects are common libraries. If you don't have a artifact repository, you can use artifact dependency when those common libraries are required by other projects.

Compare Maven and Gradle

As I am new to learn either maven or Gradle build tools. Therefore I wonder which one I select to study between maven and Gradle and which one has more requirement and demand in the industry. I want to use these build tools for Spring and Hibernate based projects. Any suggestion would be very helpful.
Thanks
Before this is closed for "not being a good question", I'll get some comments in.
You might want to learn the same thing that most other developers want to learn. Look at the third slide of the following slideware, which shows the results of Zeroturnaround's yearly developer survey. For this set of >2k developers, when asked what technologies they were interested in learning, Gradle was at the top of the list.
You can use either Maven or Gradle to build projects using Spring or Hibernate, but it's useful to point out that both the Spring and Hibernate code bases (not necessarily the applications using them) use Gradle to build their deliverables.
Maven provided the best build solution for quite a few years, but it's difficult to customize a build, and most Maven build scripts are very "noisy". Gradle solves those problems, while providing a smooth migration path from Maven or even Ant.

How to migrate build with xml-maven-plugin transformation to sbt?

Context: I'm trying to convert an existing scala project that's been built using maven to SBT so I can take advantage of the multiple scala version building logic that SBT brings to publish 2.10 and 2.11 artifacts for this library.
Problem I'm running into is replicating the xml-maven-plugin transformation configuration (I used a gist, because it didn't paste into here very nicely at all, and it's not small)
Is my solution to re-implement whatever the xml-maven-plugin is doing in scala code in a Build.scala (or other file) and use it in build.sbt as a task? Is there an existing plugin out there for SBT that can do XSL transformations? Is there a much simpler way to do this?
You may be able to stick with the maven plugin using sbt maven plugin. It may or may not mess with your build, but may be worth a try at least.
For pure scala, you have something like sbt-xslt-plugin. It's very immature and outdated. However, you may be able to quickly modify it to do the tasks you were using xml-maven-plugin for. The amount of scala code that makes up that plugin is about as much xml code you have in your xml-maven-plugin config, so it should be a heavy task.

Gradle context sensitive support in STS/Eclipse

I am trying to evaluate Gradle as next-gen build tool for some of my future projects.
Steps I've done so far:
I have Java 7 installed on my machine.
Installed Gradle 2.0
Installed Spring Tool Suite 3.6.1, went to dashboard and added support for
Gradle and installed also Groovy-Eclipse package.
Now when I start Gradle projects from scratch or I clone some of the projects from github,
I am not able to get context sensitive help, like Ctrl + Space to autocomplete stuff in
build.gradle file.
I was reading a lot of documentation on net about this, and couldn't find proper answer, so if someone can give me some idea is it working?
Previously I was using Maven, and m2-eclipse, so when I type in pom.xml I am able to do Ctrl + Space which prevents me to make typo mistakes.
NOTE: Just please note that I've enabled Gradle DSL support for my Gradle projects.
Thank You
Gradle's build language is much more dynamic, extensible, and powerful than a Maven POM, and hence it's much harder to develop full IDE support for it. Recent versions of the Eclipse Gradle Plugin have limited editing support, and work is underway to take it to the next level. IntelliJ 14 is already further along, but expect to see further improvements there as well.

Writing a Sonar plugin to measure class usage

I need to write a Sonar plugin to keep track of the library classes that are used the most in a project.
So far I read the Coding a Plugin guide but I am a little bit confused. Does Sonar provide any facility to perform analysis (Something like parsing of Java code, creation of Abstract Syntax Trees, ...) or should I look for an external tool that does it and use Sonar only as a reporting tool?
Sonar provides a framework for publishing your own code analysis results into to Sonar so that they are in a single place. Although it does some analysis of it's own it mostly relies on other static code analysis tools and just integrates them into the lifecycle, e.g., test coverage can be implemented by cobertura or clover.
Sounds to me though like you just to get a measure of the Afferent couplings which can be configured for a single library. Not sure how you would manage it for cross library dependencies as most of the plugins work by using instrumenting the code at compile time which would not be possible for classes already in a jar.
If you just want to generate an AST then you should check out this question.

Resources