I'm trying to make an old Netbeans project run.
However, certain references are broken:
Normally, one would install mongoldb-java-driver by augmenting the pom-file accordingly, see: https://mongodb.github.io/mongo-java-driver/
However, this Netbeans project does not have a pom file (I don't know why).
How can I add the missing files and folders to the project without a pom-file?
You can try downloading the Netbeans 8.2 from Oracle directly as it will contain by default the maven plugin and in this case might solve your problem.
Related
Setup:
Intellij IDEA community edition 2020.2
Spring Bott starter parent: 2.3.5
Java 11
WRAPPER_VERSION: 0.5.6
mvn 2
Hi,
I googled a lot e.g. here but I just can't fix it.
I created a new mvn spring project with Intellij. When I commit the project I get errors detected by code analyses in class: MavenWrapperDownloader.java.
e.g. It reports:
Cannot resolve symbol String
I tried:
invalidate caches and restart
delete .idea folder and reimport
checked sdk setup
mvn reimport
mvn clean and then rebuild (while the build is always successful)
I'm pretty new to maven. I guess the scope of the mvn package might be wrong because the build process works as expected.
UPDATE:
I reinstallt my openjdk11. No success. Then I found out that my .mvn/wrapper dir is not set as source root. I know that was never the case in my other projects. As a trial I've set my .mvn folder as source root and now the MavenWrapperDownloader.java file is recognized as a java class and the compiler interprets the symbols. But now there is another error. It says I have to define a package name for that class because the class does not have one per default. It is pretty strange to me. I also tried to use another spring boot starter version but nothing changed
When I execute Analyze->inspect code I get the following:
I had the same problem and File -> Invalidate Caches/Restart fixed it - at least for now.
IntelliJ Ultimate 2020.3
Spring Boot Starter Parent 2.4.2
Java 15
Maven 4.0.0
Maven Wrapper 0.5.6
The easiest solution is to generate your project again with Spring Starter.
After you set up everything you need at pom file -> Generate -> Download it.
Open with your IDE and copy-paste all code sources which you have already written.
I am using the latest version of the cxf-xjc-plugin (https://cxf.apache.org/cxf-xjc-plugin.html) plugin, 3.1.0. This plugin generates Java classes for the given xsd files successfully. When I run a clean on the project, the target/generated-sources/java folder is left in place. I've simplified my POM to only use this plugin and the problem persists.
Older versions of the plugin do not do this as don't other similar plugins like jaxb2-maven-plugin.
I have looked at the projects POM and I don't see the clean plugin being configured to protect these files. What else could be going on to cause this?
What OS are you using? Could it be a permission issue where you built as root outside the ide once? I also saw this
Why doesn't Maven's mvn clean ever work the first time?
I'm using Intellij 13, I've been using Maven quite happily for awhile now to manage the JAR dependencies.
But the last few I've imported are causing a broken classpath issue, and they're not being installed to the repository.
I though it might be just the JSONPath library, but when I tried to install Selenium drivers it also happened with those libs. I checked the local repository and the directories exist, but the JARs haven't downloaded.
This only started happening recently, and a lot of other dependencies have been installed fine (but not since this issue started happening). I'm really not sure what might have caused it.
Does anyone know how to troubleshoot this? Or why the JARs aren't installing? And can I just trigger an update somehow from Intellij to try to reinstall them?
Quick Edit Here:
I tried installing the modules using Intellij's "add library" feature. It installed them fine, whereas before I was just updating them directly in the pom.xml and it was downloading them.
The library feature seems a little better because it automatically adds them to my output artefacts anyway, but it would be nice if it also updated the pom so I can use it outside of the intellij environment.
So I'm not sure why updating the pom.xml isn't working any more...
I've had this issue in IntelliJ IDEA 2017 Ultimate.
After changing dependency versions, the IDE was unable to fix the path on its own. I went to my ~/.m2 directory and deleted all of the dependencies for the problem jar and then executed the "ReImport All Maven Projects" action. When it was complete, the dependency issue was resolved.
I had this problem with the Community version of IntelliJ Community edition. I was able to solve the problem using this process:
Click "Help" menu
Click "Find Action" and type "Maven Settings."
Click "Maven Settings."
Click the arrow next to "Maven" on the left hand side, to see the submenu
Click "Importing"
Check "Import Maven Projects automatically" and click "OK."
This should pull in all of the Maven dependencies from the pom.xml file, without you needing to manually add the libraries.
I hope this helps.
I have encountered a problem like this.
I resolved it as follows:
Project Structure >> Modules >> your module has problem >> Dependencies
then double click the jar that have problem, go to "Configure Project Library",
and then click "+", i.e. I add dependency jar manually, otherwise, the dependency jar is red (i.e failed status) or have none.
It's not really an answer, but I moved some stuff around the POM's and it seems to be working. I've got a bad internet connection, and I found that it kept stalling trying to download some of the jar files, and Intellij didn't seem to time out when it did stall, I ended up having to restart it each time it stalled to get the JAR's to download.
But it's working okay now by just editing the pom files, which is more convenient for me than libraries.
In my case I was having this exact problem because I was trying to import a local jar-with-dependencies without classifier. To solve this I just needed to add <classifier>jar-with-dependencies</classifier> to the maven dependency, e.g.:
<dependency>
<groupId>com.my.group</groupId>
<artifactId>myartifact</artifactId>
<version>1.0</version>
<classifier>jar-with-dependencies</classifier>
</dependency>
Hope this helps someone.
There can be different root causes of this issue. For me problem was that I had a maven settings file with a different name. Problem resolved after I went to intellij maven settings and updated the maven settings file path and then after maven refreshed my projects.
I solved the probelm by deleting it in module dependencies, and then importing it again.
I want to create maven project in Netbeans. So, I do File->New project->Maven->Java Application. After that I try to build the project and get error:
The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10 is missing, no dependency information available.
But I can build this project from command line with mvn compile. Could uou tell me what is the problem with Netbeans?
NetBeans is using 3.0.4 maven by default. Unless you change that in Tools/Options menu. Are you building with 3.0.4 as well or are you using some earlier versions (2.x)?
That would explain the behaviour because 3.0.4 will not blindly rely on what artifact is in local repository but some additional metadata is also consulted to make sure your project build with the given set of defined repositories.
A common example when the problem occurs to me.
I use central directly everything downloads. when I later add a mirror, all artifacts are checked again through the mirror to make sure they are accessible. if teh Mirror doesn't actually mirror central, I get an error that way.
Another common example is: when building with 2.x, the additional metadata is not written, when later building with 3.0.4, all remote context is checked no matter what is present in local repo and the additional metadata files are constructed.
I tried to remote debug a maven plugin for a liquibase project with Intellij. IDEA is highlighting the wrong source code line.
I manually built and installed the plugin in my local maven repository from sources in my Intellij project. Intellij version is 11.1.3 and maven version is 3.0.4 running on Ubuntu 12.04.
For debugging the maven plugin I used mvnDebug comand.
If someone has any ideas please give me some advice. I'm not too used to remote debugging (in fact this is the second time I've done this).
For me, whenever IntelliJ is highlighting the wrong line, it was always because the version of the JAR/classes being used to run the application differs from my source files - i.e. different version of the sources were used to build the JAR and/or classes.
You are going to have to be sure that you are working from the exact source that was used to build the classes you are debugging.
You can verify this by looking at the classpath being used to launch the application, locating the JAR file or classes directory that contains the classes you are debugging, and verifying that they were built from the sources you are inspecting.
Note that when you are debugging third-party libraries, you often can download the "sources" jar (see IntelliJ2-IDEA get Maven-2 to download source and documentation).
If you stumbled across this post, and sure that the source and JAR are the same code, then this could be your problem.
http://youtrack.jetbrains.com/issue/IDEA-8021
Instead of doing remote debugging you can run the plugin directly from IntelliJ.
Have the liquibase plugin project loaded in IntelliJ by just pointing at the pom.xml.
Choose Edit Configurations...
Press the + button to Add New Configuration.
Select Maven.
Enter the Working directory to the project you want to run the plugin on.
Enter the Command line. Could be process-sources, compile or liquibase:status depending on what you want to do.
Press OK
Set a breakpoint in the Liquibase Mojo.
Now you can start this configuration by pressing Shift+F9.
Maven will start and finally you will see that your plugin is waiting at the breakpoint!
Make sure that you have defined the plugin in the target pom.xml with correct version and also that you build the plugin before launching it. You can ensure that by enabling Make in the Before Launch pane.