Compiling with lombok using maven and java 8 - maven-3

I am trying to get files annotated with lombok.jar to compile with maven 3 using one of the Java 8 early access releases. I have maven configured to use the java 8 compiler. The code that I am compiling has a dependency defined for lombok 0.12 in maven central. However when I compile with maven I get the following error:
[ERROR] symbol: variable log
[ERROR] location: class Foo
[ERROR] C:.....\Foo.java:[319,33] error: cannot find symbol
I have run maven in debug mode and the classpath entry specified states that the lombok 0.12 jar file is in the classpath of the project. Additionally, I tried setting lombok.jar specifically in my classpath (and I can see in env.CLASSPATH in maven debug mode) which creates the same results.
Everything builds and compiles just fine in eclipse -- what am I doing wrong with the maven configuration/environment such that I can't get compilation to success outside of eclipse?

To answer my own question -- the issue is with the version of lombok (0.12.0) not working well with java 8. To fix, I used the cutting edge version of lombok , installed it into my local maven repo with the line
mvn install:install-file -Dfile=lombok-edge.jar -DgroupId=org.projectlombok -DartifactId=lombok-edge -Dversion=0.12.1 -Dpackaging=jar
and then changed the dependencies in my pom accordingly.
Once I did that, I was able to compile from command line maven.

Related

Ant sonar command not works

I am trying to insert sonarqube setup on build.xml, getting unsupported error.
My build Java version support 1.6
Ant.sonar.qube support 2.5
If I use have version 1.8 my ant sonar command is working.ant command is not working.if I use java 1.6 ant is working and ant sonar is not working.
You already know exactly what your problem is:
If I use have version 1.8 my ant sonar command is working
...
if I use java 1.6 ant is working and ant sonar is not working.
You're facing incompatibility with the version of Java you're trying to use. Since analysis will not work with 1.6, you're best off upgrading to Java 8 and working to make whatever your other Ant target is work with that.

build Grails 3 war with specific java compiler version

I am using IDEA 15. I have a grails 3 project setup. The app server I need to deploy to has Java Version 7. My local JDK is Java 8. I have set some properties in my build.gradle to use the target version 1.7.
apply plugin: 'java'
compileJava {
targetCompatibility = '1.7'
}
When I rebuild my project, it generates class files for 1.7, but when I run a maven war build from the IDEA menu, the classes are rebuilt and end up being Java 8 versions. I have set Java version in my project to 1.7 as well, but this did not help. How can I get to where I am producing a war file from my grails app that contains 1.7 versioned class files?
Thanks!
What are you using to build war file? "grails war" or "gradle war". Try to use gradle.

Using a Grails 2.4.2 plugin as a JAR dependency in a Grails 2.2.0 project

I have a custom plugin built using Grails 2.4.2 that is to be used with multiple Grails projects as a regular JAR dependency. I have successfully exported the plugin as JAR and installed into my local Maven repository and added the corresponding dependency statements in the "dependencies" block of the BuildConfig.groovy files of the respective parent projects. e.g.:
compile 'my_package:my_custom_plugin:1.0'
One of the parent project is build using Grails 2.4.2. When I run that project with the above mentioned configuration using the command: grails run-app, it runs fine without any errors.
However, when I do the same kind of configuration in another project built using Grails 2.2.0 and run it using the command: grails run-app, it gives the following error:
Error | Fatal error during compilation org.apache.tools.ant.BuildException: java.lang.NoClassDefFoundError: org/grails/datastore/mapping/dirty/checking/DirtyCheckable (Use --stacktrace to see the full trace)
NOTE: Both these parent projects run fine when I add the same plugin as a plugin instead of as a JAR dependency using the statement like this in the BuildConfig.groovy:
grails.plugin.location."my_custom_plugin" = "../my_custom_plugin/"
Can anybody kindly guide me as to how can I resolve this issue?
Any help would be greatly appreciated.

How to build the plugin with ant on mac

I found a salesforce plugin for intellij IDEA (link), and now trying to install it. The problem is, i've never done this before. So according to instruction:
How to build and install
Until the plugin is released into the IntelliJ plugins repository, you
can following these instructions for manually building and installing
the plugin from GitHub:
Update the ANT script salesforce-plugin-xml with the location of your IntelliJ IDEA install
<!--property name="idea.path" value="C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.0.2"/-->
<property name="idea.path" value="/Applications/IntelliJ IDEA 13.app"/>
Execute the 'package' target of the ANT script - this will create a salesforce-plugin-#.#.zip file in the out directory
Go into IntelliJ IDEA settings under Plugins and select "Install plugin from disk". Select the zip file and click Ok.
I downloaded a project from github, added path to idea to salesforce-plugin.xml. Then i realized that i don't have an ant to build it. I installed homebrew, installed ant, checked the version (ant appeared, ok).
Then i stuck. I tried different combinations, how to package the plugin, The last attempt is when i changed salesforce-plugin.xml to build.xml and wrote in terminal:
ant package build.xml
got:
Buildfile: /Users/cooler/Downloads/salesforce-plugin-master/build.xml
BUILD FAILED
/Users/cooler/Downloads/salesforce-plugin-master/build.xml:36: taskdef
class com.intellij.ant.Javac2 cannot be found using the classloader
AntClassLoader[]
Can you help me please to do this in right way!?
BTW, i use Mavericks
On a Mac, you need to add /Contents to the root path of the IDEA installation. For example:
<property name="idea.path" value="/Applications/IntelliJ IDEA 14.app/Contents"/>
When generating ant build scripts:
build -> generate ant build
-> check "use current idea instance for idea.home property"
Re-generate the ant build scripts. Now the build should work propertly.

Sonarqube 5.0 maven plugin support (deprecated maven 2)

I have tried to upgrade sonar-maven3-plugin to 5.0, when executing an analysis on the new 5.0 server. I received the following error:
[ERROR] Failed to execute goal org.codehaus.sonar:sonar-maven-plugin:5.0:sonar (default-cli) on project demo-issues: Please update sonar-maven-plugin to at least version 2.3 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.sonar:sonar-maven-plugin:5.0:sonar (default-cli) on project demo-issues: Please update sonar-maven-plugin to at least version 2.3 .
Looking at the release notes, it says: "[SONAR-5705] - Drop support of Maven 2". Not only drop, the Mojo directly throws an exception. The problem is that the old maven 3 plugin (the 5.0 version) still points to the maven2 one.
Is there any way to run an analysis with the 5.0 maven plugin?
As I explained on Which sonar-maven-plugin version to use?, the plugin you have to use is org.codehaus.mojo:sonar-maven-plugin, not the internal one(s). (So no need to try to upgrade sonar-maven3-plugin)
Your issue probably comes from the fact that the version of org.codehaus.mojo:sonar-maven-plugin has been locked down in your POM or parent POM.

Resources