Xtext 2.0 maven or ant project - ant

I want to build my own xtext 2.0 project from command line.
Could anybody share real working xtext 2.0 maven pom.xml or ant build.xml file?

do you know http://code.google.com/a/eclipselabs.org/p/spray/. they build Xtext projects using Maven Tycho.

You can use this Maven archetype that creates an Xtext project with a multi module Maven layout and Tycho (manifest-first approach):
https://github.com/fuinorg/emt-xtext-archetype

Several projects that you could refer to:
https://github.com/xtext-dev/maven-xtext-example
a standard maven-xtext sample using tycho, including maven pom settings and example project. I built my xtext project following this guide.
https://github.com/aphethean/xtext-maven-examples
It'll help if you wanna write your own main class.
Also,
https://github.com/applause/applause
It's not a maven xtext project, but a very good example to show how to separate grammar core and code generator logics.
Hope this would help. :)

Related

Grails 3 Application or Plugin

If I'm looking at project source code (in Intellij) how can I tell whether the Grails source code I'm looking at is an Application or a Plugin?
I get it that the output of a Grails Application build is a WAR, and a JAR for a Plugin but I can't figure out how to tell the difference by looking at the source code.
Bonus question: If it is a multi-module project, how do I tell which module is the Application and which modules are the Plugins? Or am I missing some important concept here?
Plugins can be run as applications as well and will often have an Application.groovy file. Plugins will have a <pluginname>GrailsPlugin.groovy file which sets up the plugin. In grails 3, this is in /src/main/groovy file structure.

sonar multi-module scan with java libraries

I'm running sonar scan with following versions:
ant v3.0.5
sonar v4.5.4
sonar-ant-task v2.3
My ant project contains 100+ submodules; about half of them have external libs, and half don't
In my ant build file, following sonar properties are set:
sonar.projectKey = com.foo:bar
sonar.projectName = foobar
sonar.projectVersion = ${build.version.major}.${build.version.minor}.${build.version.subminor}
sonar.sourceEncoding=UTF-8
sonar.language = java
sonar.sources = src
sonar.java.binaries = build/classes
sonar.java.libraries = build/dependency/*.jar
Initial problem with above is that for the modules that don't have external libs, it fails since there's no jar inside /build/dependency after compilation.
According to this archive link: http://sonarqube-archive.15.x6.nabble.com/Analysis-aborts-because-of-quot-No-files-nor-directories-matching-lib-jar-quot-td5035215.html
I should be able to change the libraries property to
sonar.java.libraries = build/dependency/*
But this did not work for the combination of app versions i listed above. Using only "*" results in class not found error so i don't even think it correctly grabs the dependency jar files.
Could anyone advise if i'm using incorrect combination of the versions, or if this have regressed?
My current workaround:
Keep the "*.jar" as default project property, and add individual module's libraries property to the empty folder for those that do not have dependency jar. e.g.
module1.sonar.projectName=module1
module1.sonar.projectBaseDir=modules/module1
module1.sonar.java.libraries=build/dependency
module2.sonar.projectName=module2
module2.sonar.projectBaseDir=modules/module2
module2.sonar.java.libraries=build/dependency
... x 50 more of these
Is there more elegant solution?
thanks,
Scott
sonar.java.libraries property is handled by the SonarQube Java plugin. Please provide its version and if it is not the latest try to update.
You're on the right track. The analysis of Java multi-module projects is only easy for Maven users. :-(

How can a jar file be created from a Univocity Parsers snapshot?

I would like to use the Univocity Parsers new functionality that is present in the 2.0.0-SNAPSHOT.
I'm using IntelliJ, and am not using Maven, and currently have the univocity-parsers-1.5.6.jar present in project library, and would like to replace it with a jar created from the 2.0.0-SNAPSHOT.
How can a jar file be created from a Univocity Parsers snapshot?
Any help would be greatly appreciated.
You can just download the jar from maven central:
https://oss.sonatype.org/content/repositories/snapshots/com/univocity/univocity-parsers/2.0.0-SNAPSHOT
A new SNAPSHOT jar will be generated every time relevant features / bugfixes are applied.
If you want to build from the source code, run mvn install using the command line or from IntelliJ itself.

Grails inline plugin notation for Java project dependencies?

I've successfully used Grails's inline / inplace plugin notation to develop my Grails app and several plugins concurrently. I only have to compile my Grails app and all the inline plugins get compiled too (great!):
grails.plugin.location.myFooPlugin = '../plugins/foo-plugin'
Can I do the same thing for a Java dependency rather than a Grails plugin?
Let's say I have some Java project that ultimately produces a JAR, but rather than compile and store the JAR in my Maven local repo I'd like to simply compile my Grails app and have the Java project's code also compiled as a result. Possible? If so, what are the rules, such as dir structure adherence? I might want to use Gradle or Maven, not sure.
I'm using a java dependency in my Grails project with help of /scripts/_Events.groovy:
eventCompileStart = {
projectCompiler.srcDirectories << "${basedir}/../your_java_proj/src".toString()
}
The java project will be compiled automatically along with e.g. grails war commando.

PMD with grails project

Does PMD works with grails project, i.e. with .groovy files??
i'm using STS editor,
if it works, what setup i have to do?
Please let me know, if anyone have any idea
Thanks in advance
I'm not aware of any PMD plugin for Groovy/Grails. However, there is a CodeNarc Grails plugin, which does similar kinds of static analysis on Groovy/Grails code.
codeNarc is one of the best choices for grails projects, thou it is ignoring java classes that potentially are part of your project.
I have not seen any pmd or findBugs plugins for grails that would take care of the java portion. You can use the STS/Eclipse PMD plugin thou to analyze explicitly the src/java/ folder.
Unfortunately the findBugs eclipse-plugin is not able to limit to a certain parts of the project so it no big use (findBugs works purely on class files and works through the complete project).
I guess it should be possible to write a grails pmd plugin that would analyze the java parts of a grails project.
Starting with Grails 3, the build system uses Gradle. There is a PMD gradle plugin which you could use to perform static analysis on your java source files. There is also a Codenarc gradle plugin which you can use to perform analysis on the groovy files in your project.
https://docs.gradle.org/current/userguide/pmd_plugin.html

Resources