Missing package paths/symbols from both command-line Maven build and IDEA build Follow
I saw another, similar post from 2016-1018 on this. `External Libraries` at `Project` pane's bottom clearly shows that I have the JARs containing the package paths and symbols that turn up missing during compilation regardless of whether I do the build/rebuild from the IDE or from the command line. So, this isn't a problem with IDEA, but if I am able to figure out how to solve it in IDEA it may be solved also for the command line.
I have done `Invalidate Cache/Restart`, erased ~/.m2/repository, `mvn clean` etc. On the command line, I watch Maven stream messages such as "Downloaded from central: ..." and see the JARs I need come in and, as I say, I also see the JARs at the bottom of IDEA's Project pane under External Libraries. It does me no good to add stuff to `Module Dependencies` as I must be able to build from command line (well, Jenkins does anyway).
It is a multiple module project. All versions are kept as properties in the parent pom.xml. Some common dependencies are kept in the parent pom.xml too. Some dependencies that are unique to a submodule are kept in the submodule's pom.xml.
I am really pulling my hair out here. Any thoughts or suggestions would be welcome!
Running Maven 3.6.0 at command line, IntelliJ IDEA 2019.1.2 Ultimate in Linux Mint (Ubuntu). Compiler is OpenJDK 11.
Please sign in to leave a comment.
>clearly shows that I have the JARs containing the package paths and symbols that turn up missing during compilation
Double check the jars actually exist on the file system.
>So, this isn't a problem with IDEA, but if I am able to figure out how to solve it in IDEA it may be solved also for the command line.
If it does not work from command line it will not work from IDE. What error do you get when building from command line?
Double check that the needed libraries are actually configured for these modules: the module's pom.xml file must have these libraries declarations listed.
In Maven projects tool window you can check what library dependencies does each module actually have configured:
Or you can do it from command line Maven check with dependency tree command what libraries are configured for these modules.
Then check that these libraries actually have the classes needed.
Thanks for responding, Andrey,
The JARs exist in the filesystem, but the example here is from our Nexus artifactory. There are 427 errors--all related to various missing symbols from both private JARs (from maven-releases in Nexus) and some (but not all) public JARs from Maven Central.
See illustrations below. Note red-circles which demonstrate a) that External Libraries has the JAR in question, b) that the compiler run by IDEA/Maven believes that it doesn't have the JAR. In the second illustration note that the JAR, which I built myself, then deployed to Nexus, does indeed contain the class in the expected package.
(Sorry for shamelessly obscuring the name of my company: they shouldn't be embarrassed when I'm the idiot. ;-) )
In the filesystem, I'm looking inside the legacy-feeder JAR that I built myself, then deployed to Nexus. From the command-line Maven output I see:
Downloaded from maven-releases: http://maven.xxxxxxxxxxxx.com:8081/repository/maven-releases/com/xxxxxxxxxxxx/legacy-feeder/20190520/legacy-feeder-20190520.jar (2.3 MB at 29 MB/s)
...and here's a view of the missing class using Nemo (filesystem explorer):
Contents of the submodule pom.xml (references parent pom.xml):
Contents of the parent pom.xml: (forces in legacy-feeder for all modules)
Oh, yeah, you asked what errors I get from the command line. I chose a bad example. I do get errors for missing symbols, but not for the missing Java package which was the error in the IDE I chose to use as my example. In this exact case, an error the compiler gives me (command line) is missing RegularExpressionMatch, which is on that missing package path. This happens 31 lines later. (I guess the compiler doesn't complain about import statements.)
[ERROR] /home/russ/sandboxes/nifi-pipeline.master/nifi-shared/src/main/java/com/xxxxxxxxxxxx/feeder/filter/extractors/DataExtractor.java:[41,38] cannot find symbol
symbol: class RegularExpressionMatch
location: class com.xxxxxxxxxxxx.feeder.filter.extractors.DataExtractor
The IDE also gives me this error two errors after the one I used in the example.
You need first to fix issues with Maven build from command line. Please follow my recommendations above. Make sure each module has needed dependencies configured.
I'm sorry, each module does have needed dependencies configured. I've been through the errors over and over. I wish this were a more deterministic and debuggable process.