Reputation: 513
Here is the pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sample</groupId>
<artifactId>whiteboard</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>whiteboard</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
</properties>
<repositories>
<repository>
<id>java.net-promoted</id>
<url>https://maven.java.net/content/groups/promoted/</url>
</repository>
</repositories>
<build>
<finalName>whiteboard</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax.json-api-1.0</groupId>
<artifactId>javax.json-api-1.0</artifactId>
<version>2.8</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
</project>
I am using two jar files /javax.json-api-1.0-2.8.jar and javax.websocket-api-1.0.jar. when i run my project the following exception occurs
Failed to execute goal on project whiteboard: Could not resolve dependencies for project org.sample:whiteboard:war:1.0-SNAPSHOT: Failed to collect dependencies for [javaee-api:javax:jar:7.0-b77 (compile), javax.websocket:javax.websocket-api:jar:1.0 (compile), javax.json-api-1.0:javax.json-api-1.0:jar:2.8 (compile)]: Failed to read artifact descriptor for javaee-api:javax:jar:7.0-b77: Could not transfer artifact javaee-api:javax:pom:7.0-b77 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 1]
Upvotes: 0
Views: 3668
Reputation: 460
Please check the version number, group id and artifact id of jar you are going to use before adding it to pom.xml. It will be there as part of the metadata xml for that jar. http://search.maven.org/remotecontent?filepath=javax/json/javax.json-api/maven-metadata.xml
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
Upvotes: 2