[java] The POM for project is missing, no dependency information available

Background

Trying to add a Java library to the local Maven repository using a clean install of Apache Maven 3.1.0, with Java 1.7. Here is how the Java archive file was added:

mvn install:install-file \
  -DgroupId=net.sourceforge.ant4x \
  -DartifactId=ant4x \
  -Dversion=0.3.0 \
  -Dfile=ant4x-0.3.0.jar \
  -Dpackaging=jar

This created the following directory structure:

$HOME/.m2/repository/net/sourceforge/ant4x/
+-- 0.3.0
¦   +-- ant4x-0.3.0.jar.lastUpdated
¦   +-- ant4x-0.3.0.pom.lastUpdated
+-- ant4x
    +-- 0.3.0
    ¦   +-- ant4x-0.3.0.jar
    ¦   +-- ant4x-0.3.0.pom
    ¦   +-- _remote.repositories
    +-- maven-metadata-local.xml

The project's pom.xml file references the dependent project (the tree above) as follows:

<properties>
  <java-version>1.5</java-version>
  <net.sourceforge.ant4x-version>0.3.0</net.sourceforge.ant4x-version>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...
<dependency>
  <groupId>net.sourceforge</groupId>
  <artifactId>ant4x</artifactId>
  <version>${net.sourceforge.ant4x-version}</version>
  <scope>provided</scope>
</dependency>

Problem

After running mvn compile, the following error was returned (full log on Pastebin):

[ERROR] Failed to execute goal on project ant4docbook: Could not resolve dependencies for project net.sourceforge:ant4docbook:jar:0.6-SNAPSHOT: Failure to find net.sourceforge:ant4x:jar:0.3.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

The documentation notes a number of issues that could be present, however none of these appear to apply.

Ideas

I tried the following, as per the documentation:

  1. Copy default settings to user's home directory for Maven:
    cp /opt/apache-maven-3.1.0/conf/settings.xml $HOME/.m2/.
  2. Edit the user's settings.xml file.
  3. Update the value for the local repository:
    ${user.home}/.m2/repository
  4. Save the file.

I also tried the following commands:

mvn -U
mvn clear -U

I tried using Maven 3.0.5, but that failed, too.

Question

How do you force Maven to use the local version of the library, rather than trying to seek out a library that is not yet available to download?

Related

Related questions and information that did not resolve the issue:

This question is related to java maven build compilation pom.xml

The answer is


The scope <scope>provided</scope> gives you an opportunity to tell that the jar would be available at runtime, so do not bundle it. It does not mean that you do not need it at compile time, hence maven would try to download that.

Now I think, the below maven artifact do not exist at all. I tries searching google, but not able to find. Hence you are getting this issue.

Change groupId to <groupId>net.sourceforge.ant4x</groupId> to get the latest jar.

<dependency>
  <groupId>net.sourceforge.ant4x</groupId>
  <artifactId>ant4x</artifactId>
  <version>${net.sourceforge.ant4x-version}</version>
  <scope>provided</scope>
</dependency>

Another solution for this problem is:

  1. Run your own maven repo.
  2. download the jar
  3. Install the jar into the repository.
  4. Add a code in your pom.xml something like:

Where http://localhost/repo is your local repo URL:

<repositories>
    <repository>
        <id>wmc-central</id>
        <url>http://localhost/repo</url>
    </repository>
    <-- Other repository config ... -->
</repositories>

Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to maven

Maven dependencies are failing with a 501 error Why am I getting Unknown error in line 1 of pom.xml? Why am I getting "Received fatal alert: protocol_version" or "peer not authenticated" from Maven Central? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Unable to compile simple Java 10 / Java 11 project with Maven ERROR Source option 1.5 is no longer supported. Use 1.6 or later 'react-scripts' is not recognized as an internal or external command How to create a Java / Maven project that works in Visual Studio Code? "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository Java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException

Examples related to build

error: This is probably not a problem with npm. There is likely additional logging output above Module not found: Error: Can't resolve 'core-js/es6' WARNING in budgets, maximum exceeded for initial How can I change the app display name build with Flutter? Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0) Still getting warning : Configuration 'compile' is obsolete and has been replaced with 'implementation' Could not find com.android.tools.build:gradle:3.0.0-alpha1 in circle ci Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details Component is part of the declaration of 2 modules Maven build Compilation error : Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Maven

Examples related to compilation

WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' How to enable C++17 compiling in Visual Studio? How can I use/create dynamic template to compile dynamic Component with Angular 2.0? Microsoft Visual C++ Compiler for Python 3.4 C compile : collect2: error: ld returned 1 exit status Error:java: invalid source release: 8 in Intellij. What does it mean? Eclipse won't compile/run java file IntelliJ IDEA 13 uses Java 1.5 despite setting to 1.7 OPTION (RECOMPILE) is Always Faster; Why? (.text+0x20): undefined reference to `main' and undefined reference to function

Examples related to pom.xml

Why am I getting Unknown error in line 1 of pom.xml? Maven:Non-resolvable parent POM and 'parent.relativePath' points at wrong local POM Meaning of ${project.basedir} in pom.xml Maven and Spring Boot - non resolvable parent pom - repo.spring.io (Unknown host) Maven: How do I activate a profile from command line? repository element was not specified in the POM inside distributionManagement element or in -DaltDep loymentRepository=id::layout::url parameter What is <scope> under <dependency> in pom.xml for? The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path Maven error in eclipse (pom.xml) : Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 Missing artifact com.oracle:ojdbc6:jar:11.2.0 in pom.xml