0

I have to include fixedformat4j-root dependency in my pom.xml. I get artifact info (group, version, ...) from the pom.xml of the project homepage:

https://github.com/jeyben/fixedformat4j/blob/master/pom.xml

When I store that info to my pom.xml, I got this error from m2e eclipse plugin:

Missing artifact com.ancientprogramming.fixedformat4j:fixedformat4j-root:jar:1.4.0-SNAPSHOT

This is my pom.xml

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  ...
  <dependencies>
    ...
    <dependency>
      <groupId>com.ancientprogramming.fixedformat4j</groupId>
      <artifactId>fixedformat4j-root</artifactId>
      <version>1.4.0-SNAPSHOT</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>bintray</id>
      <url>http://jcenter.bintray.com</url>
    </repository>
    <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </pluginRepository>
  </pluginRepositories>
  <build>
    ...
  </build>
  <reporting>
    ...
  </reporting>
</project>

How can I solve this error? Should I set a new repository? Where can I find the repository url from the project pom.xml?

Tobia
  • 9,165
  • 28
  • 114
  • 219
  • 2
    Post your POM here and the error message in text. – Tunaki Jan 28 '16 at 14:42
  • `cannot catch the artificat maybe because it is not so popular.` ?? how do you determine that – Naman Jan 28 '16 at 14:43
  • Because of the missing artificat error, I posted my pom and the error message of m2e – Tobia Jan 28 '16 at 14:50
  • Two completely different problems are likely: Maven cannot download your jar from any known repository, or there's a misunderstanding about the exact filename of a SNAPSHOT version jar (with or without timestamp). To start diagnosing the problem, leave out the Eclipse integration and run the normal command-line mvn tool to worry about your POM and your settings.xml only, not about Eclipse build paths. Can you build your program with mvn? What are the verbose error messages from mvn? – Lorenzo Gatti Jan 28 '16 at 14:58
  • Maybe the problem is easier, I cannot understand how to read a pom.xml from an external project. I found this project in github and I want to include it in my pom, what can I do? My workaround is to download jar file and add it manually, but I think there is a better way! – Tobia Jan 28 '16 at 15:00
  • 1.2.2 is the latest version in [maven central](http://search.maven.org/#artifactdetails%7Ccom.ancientprogramming.fixedformat4j%7Cfixedformat4j%7C1.2.2%7Cjar) and [mavenrepository](http://mvnrepository.com/artifact/com.ancientprogramming.fixedformat4j/fixedformat4j). – lschuetze Jan 28 '16 at 15:01
  • 1
    Change `artifactId` to "fixedformat4j" and `version` to "1.2.2" – jmruc Jan 28 '16 at 15:05
  • @jmruc yes, change solve the error because I can find a version from apache repo. Anyway can I get the last version of the project from github? – Tobia Jan 28 '16 at 15:07
  • Tobia, sorry but no, you either have to use a published version of the artifact, or to include a jar file like shown in the duplicated question. – jmruc Jan 28 '16 at 15:09
  • Ok I hoped that there was something to link maven to pom.xml from github. – Tobia Jan 28 '16 at 15:14

1 Answers1

0

Neither of the repositories you've listed in your POM contain that version of that artifact. They each contain several release versions, but no snapshots.

Looking at the source for this artifact it does appear to be at version 1.4.0-SNAPSHOT but that version has not been deployed to a repository. Either build it yourself locally (via mvn clean install) or reference one of the versions in the given repositories.

tdrury
  • 2,307
  • 1
  • 22
  • 25
  • Can you please explain better "reference one of the versions in the given repositories"? – Tobia Jan 28 '16 at 15:02
  • you can open those two repository URLs in a browser, then navigate to com/ancientprogramming/fixedformat4j and see the versions available. For example: http://jcenter.bintray.com/com/ancientprogramming/fixedformat4j/fixedformat4j/ shows a few release versions (last is 1.2.2) but there is no 1.4.0-SNAPSHOT directory. (and for that repo your configuration has disabled snapshots). It's not on maven central either. – tdrury Jan 28 '16 at 15:08