IntelliJ error messages for Maven Plugin Annotations - java

I am getting incorrect error messages in IntelliJ for a Maven plugin I am creating.
I have the following dependencies in my pom:
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
I am using IntelliJ 12.0
The incorrect errors are in the screenshot. does anyone know what can cause this?
the code runs just fine with a clean install

Try to delete your local ~/.m2/repo. And maybe reinstall Intellij without reimporting your old settings and start fresh.

Related

Ignore optional reactor-extra maven dependecies when running springboot app in docker

I have a Spring Boot app that i run in a docker container using docker-compose.
I recently added the reactor-extra dependency to my pom.xml and for some reason i can't start the container anymore.
Here's what i added to the pom:
<dependency>
<groupId>io.projectreactor.addons</groupId>
<artifactId>reactor-extra</artifactId>
<version>3.4.2</version>
</dependency>
Now whenever i try to start the container i get this error:
Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline (default-cli) on project backend: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.5.2 in central
The code works fine when i run it directly on intellij and there are apparently no dependency issues.
I took a look here: https://mvnrepository.com/artifact/io.projectreactor.addons/reactor-extra/3.4.2
and it seems that this "4.5.2" version of org.eclipse.swt.gtk.linux.x86_64 does not exist. I assume this works on intellij because this is an optional dependency but the container building process fails when it tries to download that version.
I tried excluding it like so:
<dependency>
<groupId>io.projectreactor.addons</groupId>
<artifactId>reactor-extra</artifactId>
<version>3.4.2</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId>
</exclusion>
</exclusions>
</dependency>
But it's still trying to download it and i get the same error which causes the build to fail.
I also tried adding the existing 4.3 version of org.eclipse.swt.gtk.linux.x86_64 to my pom but i still get the same result.
<dependency>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId>
<version>4.3</version>
</dependency>
<dependency>
<groupId>io.projectreactor.addons</groupId>
<artifactId>reactor-extra</artifactId>
<version>3.4.2</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId>
</exclusion>
</exclusions>
</dependency>
How can i prevent maven from trying to download that dependency?
I fixed it by adding this to my pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
</plugin>
Source:
go-offline fails when optional dependencies cannot be resolved
https://issues.apache.org/jira/browse/MDEP-690
"Running org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline against this project passes. With version 3.1.2 the goal fails with:"
org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.5.2 in central (https://repo.maven.apache.org/maven2)

Maven Site Plugin with Java9

I have a problem running my CI builds on Travis with Java9 (Oracle JDK 9).
I fails on maven-site-plugin - after removing it everything works smothly.
I tried removing everything else to check for possible dependencies collisions, left out with just this one plugin build still fails. It is just a pom container, still failing with just a simple site plugin (updated to latest version that claimed to be java9 ready).
Here are all of the resources:
failing Travis build
Travis configuration
project POM file
Looking for similar problems on the web I found that usually it's plugin compatibility (all of the plugins ware updated) or different dependencies versions, but I removed all of them and it still fails.
The builds run locally on OpenJDK 9 perfectly fine.
-edit-
After applying hint from #nullpointer :
updated POM
CI error
You should probably wait and update to using version 3.7 of site plugin as mentioned here.
Seems like you are encountering something similar to #MSITE-796
Quoting further from the same link:-
The release will need a little bit more time due to pending
SNAPSHOT-dependencies which need to be released first. So either have
a little bit more patience or add doxia-sitetools 1.7.5 as a dependency
to the maven-site-plugin in your own project.
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sitetools</artifactId>
<version>1.7.5</version>
</dependency>
-edit-
As doxia-sitetools is just a pom container project one needs to update all of it's modules directly:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.6</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-decoration-model</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-skin-model</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-integration-tools</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-doc-renderer</artifactId>
<version>1.7.5</version>
</dependency>
</dependencies>
</plugin>

Unable to get Groovy version from GroovySystem, trying InvokerHelper

we are using groovy on a java + maven project and getting below error during the build:
INFO] Unable to get Groovy version from GroovySystem, trying InvokerHelper.
[ERROR] Your Groovy version (1.1-rc-1) doesn't support compilation. The minimum version of Groovy required is 1.5.0. Skipping compiling.
My pom.xml have this dependency:
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.12</version>
<scope>compile</scope>
</dependency>
Any idea?
try this, it works for me:
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.5.7</version>
<type>pom</type>
</dependency>
I faced the same problem. in my case, groovy-all.jar was corrupted. if it is so you can do followings
remove
$USER_FOLDER\.m2\repository\org\codehaus\groovy\groovy-all
then
Right click on the project click Maven->Update Project
as shown below image.

Missing artifact error when adding a Maven dependency

I am not familiar with maven but I need to add a jnativehook dependency in a Java/Jersey project. I tried to add this dependency in my pom.xml
<dependency>
<groupId>com.1stleg</groupId>
<artifactId>system-hook</artifactId>
<version>2.0.3</version>
</dependency>
But I get an error on Eclipse
Missing artifact com.1stleg:system-hook:jar:2.0.3
According this, it should be:
<dependency>
<groupId>com.1stleg</groupId>
<artifactId>jnativehook</artifactId>
<version>2.0.3</version>
</dependency>
instead of
<dependency>
<groupId>com.1stleg</groupId>
<artifactId>system-hook</artifactId>
<version>2.0.3</version>
</dependency>
Hope it helps!

Using OCL in Maven/Tycho-surefire

I am trying to run a eclipse plugin test that uses OCL, more specifically:
Diagnostic diagnostic = Diagnostician.INSTANCE.validate(modelRoot);
Which works fine if i run it as rightclick -> run as ... -> Eclipse Plugin Test
But if i try to run it via maven (maven install) it fails with the following errormessage:
java.lang.AssertionError: Unable to find delegate to evaluate the 'constraint' on ...
I tried adding
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>org.eclipse.tycho.surefire.junit4</artifactId>
<version>0.14.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.ocl</groupId>
<artifactId>ecore</artifactId>
<version>3.3.0-v20130520-1222</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>ocl</artifactId>
<version>1.1.0-v200706201508</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf.query</groupId>
<artifactId>ocl</artifactId>
<version>1.1.0-v200706071712</version>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>ocl</artifactId>
<version>3.4.0-v20140524-1358</version>
</dependency>
to the tycho dependenncies (in the pom), but without any sucess. I would greatly appreciate any ideas on how to fix this
to run tycho test you have to configure the target platform for the test first, Please refer to this
hope this helps

Categories