MapStruct code generation to maven generate-source phase - maven-3

Is it possible to configure mapstruct to generate mappers in generate-sources instead of compile?

MapStruct is an annotation processor. Which means that the code that is generated is generated by the Java Compiler during compilation. You need to check if there is a way to configure the maven compiler, or the gradle apt plugin in order to achieve this

Related

Bazel: hermetic use of jar command?

We have a custom Skylark rule that invokes jar after using the Thrift compiler to generate .java files, modeled after genproto.bzl.
What is the recommended way to invoke an external jar command in a hermetic way? Should we use new_http_archive to pull in the JDK archive (and how would this work with the DMG Oracle provides for OSX) with something like jdk.BUILD?
You have #local_jdk//:jar that expose the jar binary coming from the jdk used by Bazel.

Grails BuildConfig.groovy, difference between build, compile, and runtime?

What's the difference between build, runtime, and compile, in BuildConfig.groovy (1.3.7)
grails.project.dependency.resolution = {
plugins {
build "acme:acme-cache:latest.integration"
}
dependencies {
build "com.foo.bar:foobar:1.0.5"
runtime "org.apache.httpcomponents:httpclient:4.0.3"
compile("com.thoughtworks.xstream:xstream:1.3.1")
}
}
build - dependency that is only needed by the build process
runtime - dependency that is needed to run the application, but not compile it e.g. JDBC implementation for specific database vendor. This would not typically be needed at compile-time because code depends only the JDBC API, rather than a specific implementation thereof
compile - dependency that is needed at both compile-time and runtime. This is the most common case
There are a couple of other dependency scopes:
test - dependency that is only needed by the tests, e.g. a mocking/testing library
provided - dependency that is needed at compile-time but should not be packaged with the app (usually because it is provided by the container). An example is the Servlet API
It seems the 2 previous answers conflict on the distinction between compile and build. I believe that build is the scope that includes grails compile and grails run-app, while compile is just the former.
Starting from Grails 3, dependencies are managed by Gradle. The grails-app/conf/BuildConfig.groovy file has been replaced by the build.gradle file in the project's root.
The Grails user guide explain how to set grails depencies with gradle. See also the related Gradle documentation for further details on managing dependencies using it.
A couple grails commands help illustrate the difference. Consider grails run-app and grails compile. grails compile is the compile step and will include compile-time dependencies. grails run-app is the run step and will include runtime dependencies. Build dependencies are anything that you might need to run any of these commands, for example, a custom script that hooks into some build events.
So you would pick the one that best fits when you need to be certain the dependency is included.

Xtext 2.0 maven or ant project

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. :)

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

Create project from maven archetype via Apache Ivy

If you want to create project with a Maven archetype you type
mvn archetype:generate -DarchetypeGroupId=... -DarchetypeArtifactId=... \
-DarchetypeVersion=... -DgroupId=... -DartifactId=... \
-Dversion=...
How this line would change if you are using Ivy?
ivy is not a drop in replacement for maven, it's a dependency manager for ant.
If you want to use archetypes ivy won't be of any help
Since Ant + Ivy is all about configuration and flexibility, since this combo doesn't rely on conventions, since it doesn't suggest any methodology or structure, what should a "default" Ant + Ivy project looks like? Does this question even make sense?
You'll find some template for an empty project (like this ivy-template) though.

Resources