I have a groovy class in maven java project. I upgraded the groovy dependency from 2.4.4. to 2.4.11. If I build the project using maven - it works. However, if I build it with IntelliJ - I get this error:
Information:Groovyc: While compiling MyProject: Conflicting module versions. Module [groovy-jsr223 is loaded in version 2.4.11 and you are trying to load version 2.4.4
java.lang.ExceptionInInitializerError.
When I go to project structre -> dependencies, I see: Maven: org.codehaus.groovy:groovy-jsr233:2.4.4.
When I search all my pom.xml fiels for 2.4.4 - there is nothing left - everywhere I have 2.4.11.
I tried rebuilding all with maven, reimporting maven projects in IntelliJ - nothing works.
Where should I look for this dependency? Is there a quick way to track it?
I have found a solution - Maven Helper plugin (https://plugins.jetbrains.com/plugin/7179-maven-helper). It adds "Dependency Analyzer" tab to pom files view.
Many time this trick works for me.
go to maven widget in intellij idea and click on the refresh icon. it should do the magic.
Related
I'm having a very odd issue which I cannot explain.
I've made an artifact using gitlab ci, which I'm now importing as a dependency in another project using maven.
When I import this into the new project, I get some very strange behaviour in regards to the classes in the imported dependency. These behaviours are as follows:
In Java files (Test.java), the package is found and Intellij reports no issues. I can even navigate to the source code in the library.
In Kotlin files, Intellij complains that this package cannot be found. I can't navigate to the source code as the IDE says "unresolved reference". If I do a maven artifact search, it is found but adding it makes no difference as the dependency is already in my project.
maven compile/package also complains that this package cannot be found
The dependency is definitely present:
I've tried the following:
Reimporting maven projects
Invalidating caches
Changing java versions, 8 - 11
The artifact is written in java 11 if that makes any difference.
Please help, this is driving me crazy.
Thanks to those that answered!
After a long 24 hours of debugging, it turns out the issue is related to how intellij & maven look for packages in dependencies.
I was compiling with the spring-boot-maven-plugin which was building the jar with a top BOOT-INF directory, and the package structure below this.
This meant both intellij and maven were confused as they seemed to be able to find the package but not build it.
I've since removed the plugin and left now just compile with the kotlin-maven-plugin which has the package structure at the top level of the jar.
Now when I import into a project, the project can find and compile this dependency.
I am using Maven to use Postrgres SQL driver. Besides I am using InteliJ IDEA Ultimatre Edition, and, as I understood, Maven is included in Ultimate version initially. Correct me - all I need, is to set dependencies, and connect PostrgeSQL to Java. I am not oblige to Download Maven (except required Dependecie of course, I mean Maven as framework)? Thanks a lot!
When you are creating a new project, choose Maven. After the project is created, you will receive an empty Maven project structure with the pom.xml and a script mvnw of Maven Wrapper, which you can use (instead of mvn) to build your app.
Just add dependencies to the pom.xml and build.
The Maven Wrapper will do the work for you - download Maven into the project subdirectory and use it.
I am trying to add a POM.XML file as per this documentation: https://www.jetbrains.com/help/idea/convert-a-regular-project-into-a-maven-project.html
It says I need to choose 'Maven' from 'Add Framework Support'. But I do not have that option. Why is this so, and how can I enable this option?
Also, I did see this previously in another project I opened in the same IntelliJ IDE on my computer. Does this mean it shows up based on my project contents?
I already have tried installing following maven plugins:
Maven
Maven Helper
MavenPlugin
Maven 2 Integration
Maven Archetypes
Thank you!
I've added a Maven dependency into my Grails project, and I'm trying to get that reflected on my Eclipse setup. I've already run grails compile --refresh-dependencies and grails refresh-dependencies (I don't know the difference) but neither got the job done. There are no errors, and I can see that the dependency is correctly reported in grails dependency-report.
I don't know what the difference is, but after running refresh-dependencies using GGTS in Eclipse [project context ("right click") > Grails Tools > Refresh Dependencies], the jars appeared in the classpath.
This post is not similar to this post:
How to add facets to an IntelliJ Java/Gradle project to create a self-sufficient war
I am using the IntelliJ-IDEA 12.1.15 Ultimate, just started working on gradle with IDEA.
Previously, we have a gradle setup for Eclipse which is working.
I am using the:
apply plugin 'idea'
Can't figure out how to add settings for web facet and artifacts, have read the gradle documentation as well and various other posts but no clue yet.
There are some workaround found about manually adding the web-facet or editing the IntelliJ XMl project files from within the Gradle build script. But these seem too much of an effort, considering how it easy it is to add all this for gradle-eclipse.
So the question - Is there a clean solution for doing this? Like just making a build.gradle.
Thanks,
The newer version intelliJ 13 supports this out of the box. So just upgrade, or use a intellij-gradle-plugin (search google) for older version I haven't tested this plugin myself but read somewhere that it works.