Plugin and dependency not found - intellij-idea

i've created a project with Jhipster, when i open the project with IntelliJ i have these problems in pom.xml:
pom.xml problems
I tried maven clean/package/install, the first two run successfully but when i run maven install a test fails:
test failure
I also tried to use plugin registry (in maven settings) and invalidate caches but still not work. In the end i tried different JDK but i have the same problems. Can someone help me please?
I use JDK 11.0.15, Node 16.15.1, Git 2.36.1 and i'm on windows 10.

For those interested in troubleshooting pom.xml i solved by updating the repository (on IntelliJ go file/settings/build, execution, deployment/build tools/maven/repositories both remote and local) and reloading all maven projects.

Related

"mvn clean install" failed in command line, but passed in intellij

New to java and intellij, pls forgive me if i cannot describe the issue clearly.
Brand new install of intellij, brand new import of the java project.
From beginning, seems the project builds fine in intellij, in the GUI there's that clean/compile/verify/install/... life cycles. I click clean, then install, it triggers the unit test and all passing. Now i go to the project root in the command line, "mvn clean install" also passing.
Now i make a change to a resource file, *.sql which is used for in-memory db setup for unit test. i click clean, then install, still passes successfully.
Now i go to the command line again, "mvn clean install" fails in unit test.
I'm so confused now, either way i'm doing the "clean", what's the cause and how should to fix it pls ?
BTW, after working in visual studio for so long, this java and intellij is giving me heart attacks, why the build system in java is so hard and messy ?
Your project is likely configured differently from the maven pom.xml file. When the two aren't configured the same, you'll have problems. I would guess that some dependency is configured correctly in the IntelliJ Project file, but not in the pom.xml. I usually have the reverse problem. I use only the pom.xml to specify dependencies, and rely on the maven plugin to refresh the project (eclipse).
With IntelliJ, it's been a few years, but I remember the same idea. Try deleting the project file, and importing an existing maven pom file. Then modify your dependencies using only the pom.xml and not IntelliJ's project interface. If the pom.xml is correctly defined, the project import will work first try. That heavily depends upon the previous developer working with the project.
Maven is actually a very powerful (if not quirky at times) build tool, and the differences between execution on command line or "inside" IntelliJ are usually simple to explain.
Please check:
you are running the same version of maven (check command line with -version, compare to intellij setup in settings
you are using the same local .m2 folder (local repo) for maven vs intellij
you are not running with any "Profiles" in intellij (check that none are ticked).
you are not skipping any tests because they end with "IT" (meaning Integration Test)
These are the common reasons for differences.
If you post a log of your failing build we might be able to help more.
ok, my friend found the issue, in Maven settings in intellij, there's a "Runner" page, there's a "Skip test" there. In my case it's checked, so the run in intellij skipped unit test (which should fail) and did all other stuff, made it looks like it's passing.
Still several puzzles to me, but this "Runner" -> "Skip test" fixed the issue.
Pretty upset with intellij.

intellij on linux: Not picking up dependencies

I've just installed intellij idea in my home directory of a research cluster (Centos)
When I compile and run from the terminal using mvn install, all works fine.
When I check the settings for maven on intellij, the repository setting is correct.
I have tried reimporting the dependencies.
And yet, every time I look at code, all the dependenices are marked as not found
Any ideas as to what is going worng?

Grails application is not found after updating to IntelliJ IDEA Ultimate 2016.2

I have updated my IntelliJ IDEA Ultimate to the 2016.2 version.
I had a Grails 3 project and now when I open the IDE I get the following error when trying to run my project:
Error running Grails: My_Project: Grails application is not found
I can still open the terminal and run the project manually, but it seems that IntelliJ IDEA no longer recognises my Grails application. When going to "Edit configurations...", in "Application" it says "[none]" and I can't select anything.
Grails Version: 3.1.9
Groovy Version: 2.4.7
JVM Version: 1.8.0_66
A Simple solution to this is to refresh the gradle projects.
You can do this by popping out the little gradle tab and hitting the "Refresh All Gradle Projects"
I run into the same problem always when i restart intellij. Running grails clean command from the terminal fixed it.
First, re-import the project into IntelliJ 2016.2. Choose the build.gradle file for the import. Use the gradle wrapper or a local gradle installation, where you have given IntelliJ the path to the locally installed Gradle. Let IntelliJ re-index everything. Wait until you see no further indexing on the bottom of the screen.
Second, run the application once, with no edit configuration. After this completes with error, you should be able to choose Run -> Edit Configuration / Application.
Third, you can go into the project pane to the grails-app/init/app-name/Application.groovy file and right-click on that and choose Run. After that, an edit configuration will be created.
Finally, you can try to invalidate cache and restart. (This has nothing to do with Edit Configuration, but sometimes the gradle and/or .idea caches get out of sync.)
I had the same problem after updating to IntelliJ Ultimate 2019.2.
It seems that the "little gradle tab" of the accepted answer no longer exists.
The reason in my case was that the Gradle Plugin had been disabled by the update process.
Resolution: Hit Help > Find Action > Type gradle. You should see a line "Gradle" and a ON-OFF switch at the end of that line.
Enable it and restart IntelliJ solved my problem.

SBT, dependencies, classpath and editors

I recently updated my sbt setup to version 0.11. As you may know, new SBT uses .ivy2 folder to store/cache all the retrieved jar files. I am using IntelliJ and I would like to know what is the recommended way of importing dependencies to the editor's classpath.
One option is to manually visit .ivy2 folder and select the dependencies. Is there a better/easier way to doing this?
I presume you use the SBT-plugin. According to the instructions on the linked page:
After each change to your dependencies, run gen-idea in the SBT Console. When prompted, reload the project.
I usually run
gen-idea no-classifiers no-sbt-classifiers
(see under "Usage" on github). IntelliJ (11 RC) will then ask you to reload the project, which is usually quite fast. Then the references to your SBT dependencies will be available.
You can try IvyIDEA plug-in.

How to create my first Grails project in IntelliJ, with Maven?

The goal: create my first Grails project, in IntelliJ, with Maven support.
Myself: Noob to Groovy/Grails, has some Maven experience but not too much
The tooling: Groovy 1.7.5, IntelliJ 9.0.3 and Maven 2.0
What I've tried so far, is:
File->New Project
Create Module
Maven Module
Add & choose the Grails Archtype
Right click on the project --> Run --> grails
I'm getting errors:
PHP home is not specified - WTF, does Grails require PHP?
When I previously tried to use IntelliJ to create a Grails project without Maven, I actually managed to run the application - so I don't understand what is missing now.
P.S. I reported this as an issue, vote it up if you want.
If anyone is interested, here is a github project with all the bootstrap done.
Let's leave IntelliJ aside for now and try to get started on the command line.
The following steps work for me (basically repeating the official instructions but using version 1.3.4):
First create an application:
mvn archetype:generate -DarchetypeGroupId=org.grails \
-DarchetypeArtifactId=grails-maven-archetype \
-DarchetypeVersion=1.3.4 \
-DgroupId=example -DartifactId=my-app
And update my-app/pom.xml to use Java 6:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
Then cd into my-app and create the project structure (run maven from inside the project folder):
cd my-app
mvn initialize
Edit the application.properties file to add:
plugins.hibernate=1.3.4
plugins.tomcat=1.3.4
And run the following to install the plugins:
mvn compile
When done, you should be able to start your app
mvn grails:run-app
And to access it at http://localhost:8080/my-app/.
Once you get the above working, importing the project inside IntelliJ should be a trivial step. And if you still get a problem, it will be probably an IntelliJ related issue.
user495750. It's an IntelliJ 9 thing. Nothing I've done (or I suspect ripper234 did). I upgraded an existing Grails project that was working fine from Grails 1.2.0 to 1.3.5 and IntelliJ screws things up. You do nothing to specify a PHP server. Suddenly it thinks there's no server configured.
I managed to get things working by pointing Intellij to the new Grails Home and that fixed things. No need for the Maven incantations. That's a long winded approach. BTW: It's best to get the 1.3.6 version out of Hudson and use that - I had some YUI plugin issues. So I had to do a second update.
Right click project -> Update Grails.. -> New SDK -> point to new Grails Home.
If I recall this invokes a grails upgrade automatically for you to upgrade. Problem solved.
Grails does not require PHP. You got that error because you created PHP run configuration instead Grails run configuration. PHP run configuration may be created on any project by right click on the project --> Run --> ProjectName. It is a PHP support issue.
Grails run configuration will be created automatically after initialization of project structure.