Maven error: duplicate annotation

I’ve recently started to use Maven and got very frustrating error which took from me 24h of my life :

On compilation of unit tests (default-testCompile) I’ve got:
error: duplicate annotation 

Some larger log trace:

….
 [INFO] — maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ wol-server-test —
 [INFO] Compiling 2 source files to /home/tomek/Projects/WoL-Server/wol-server-test/target/test-classes
 [INFO] ————————————————————-
 [ERROR] COMPILATION ERROR :
 [INFO] ————————————————————-
 [ERROR] error: duplicate annotation
 [INFO] 1 error
 …..
 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (default-testCompile) on project wol-server-test: Compilation failur

As I said, it took me 24 hour of my life to find the issue.
Google is giving quite nothing useful, I thing I’m first on this issue.

The problem was … lombok val and my unusual usage of it, theoretically good.

val str1=”Some string #1″, str2=”Some string #2″;

Normally this code compiles, but with some reason it’s problematic to maven unit test compiler plugin, because it produces 2 annotatoins in one line.
Fix was simple:

val str1=”Some string #1″;
val str2=”Some string #2″; 

Hope it helped you!

Advertisements

One thought on “Maven error: duplicate annotation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s