Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Failure to read artifact

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to maven, and i am working on multi module maven project.
Here is the error i am getting in eclipse:

Description Resource Path Location Type
ArtifactDescriptorException: Failed to read artifact descriptor for javax.servlet:servlet-api:jar:${as.default.javax.servlet.version}: ArtifactResolutionException: Failure to transfer javax.servlet:servlet-api:pom:${as.default.javax.servlet.version} from 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. Original error: Could not transfer artifact javax.servlet:servlet-api:pom:${as.default.javax.servlet.version} from/to central (http://repo.maven.apache.org/maven2): Illegal character in path at index 63: http://repo.maven.apache.org/maven2/javax/servlet/servlet-api/${as.default.javax.servlet.version}/servlet-api-${as.default.javax.servlet.version}.pom pom.xml /kern-web-proxy line 1 Maven Dependency Problem



Here is my pom.xml ofkern-web-proxy project:

<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<artifactId>kern</artifactId>
<groupId>com.appamsoft.as</groupId>
<version>0.1-SNAPSHOT</version>
</parent>

<groupId>com.appamsoft.as.kern</groupId>
<artifactId>kern-web-proxy</artifactId>
<!-- <version>0.1-SNAPSHOT</version> -->
<packaging>war</packaging>

<name>kern-web-proxy</name>
<dependencies>
<dependency>
<groupId>com.appamsoft.as.kern</groupId>
<artifactId>kern-core</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${as.default.springframework.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${as.default.javax.servlet.version}</version>
<scope>provided</scope>

</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>${as.default.javax.servlet.jsp.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${as.default.slf4j.version}</version>
</dependency>
<!-- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
-->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${as.default.log4j.version}</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>${as.default.java.version}</source>
<target>${as.default.java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.5</version>
<configuration>
<wtpversion>2.0</wtpversion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>



and here is the parent pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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>com.appamsoft</groupId>
<artifactId>as</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>as</name>
<modules>
<module>tools</module>
<module>kern</module>
</modules>
<properties>
<as.default.java.version>1.7</as.default.java.version>
<as.default.junit.version>4.8.2</as.default.junit.version>
<as.default.slf4j.version>1.6.6</as.default.slf4j.version>
<as.default.log4j.version>1.2.16</as.default.log4j.version>
<as.default.javax.servlet.version>2.5</as.default.javax.servlet.version>
<as.default.javax.servlet.jsp.version>2.1</as.default.javax.servlet.jsp.version>
<as.default.springframework.version>4.0.3.RELEASE</as.default.springframework.version>
<as.default.hibernate.version>3.5.0-Final</as.default.hibernate.version>
<as.default.camel.version>2.9.4</as.default.camel.version>
<as.default.activemq.version>5.6.0</as.default.activemq.version>
<project.build.maven.compiler.plugin.version>2.3.2</project.build.maven.compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${as.default.slf4j.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${as.default.slf4j.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${as.default.log4j.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${as.default.junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${as.default.javax.servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>${as.default.javax.servlet.jsp.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>



Any help is appreciated and i am new to maven topic as well as to this forum so if i have done any mistake in asking question pardon me.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tinku,

Welcome to coderanch

The core problem is that the as.default.javax.servlet.version, even though you have defined it in the parent pom.xml.

The parent of com.appamsoft.as.kern:kern-web-proxy is com.appamsoft.as.kern:kern. The parent pom is com.appamsoft:as. Does com.appamsoft.as.kern:kern inherit from com.appamsoft:as?
 
tinku verma
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:tinku,

Welcome to coderanch

The core problem is that the as.default.javax.servlet.version, even though you have defined it in the parent pom.xml.

The parent of com.appamsoft.as.kern:kern-web-proxy is com.appamsoft.as.kern:kern. The parent pom is com.appamsoft:as. Does com.appamsoft.as.kern:kern inherit from com.appamsoft:as?


Sorry for the late reply,
I don't know how to check whether com.appamsoft.as.kern:kern is inherited from com.appamsoft:as
According to my understanding you are saying there must be <parent> section in kern:kern pom.xml, which inheriting com.appamsoft.as
Am i right?
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. If you have the kern pom.xml, you can look at the parent section
 
tinku verma
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:Yes. If you have the kern pom.xml, you can look at the parent section


I have added <parent> section in pom.xml of kern as below:
<parent>
<artifactId>as</artifactId>
<groupId>com.appamsoft</groupId>
<version>0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Now i am getting another error,
Failed to execute goal on project kern-web-proxy: Could not resolve dependencies for project com.appamsoft.as.kern:kern-web-proxy:war:0.1-SNAPSHOT: Could not find artifact org.springframework:spring-webmvc:jar:4.2.2 in central (https://repo.maven.apache.org/maven2) ->

I have edited the pom.xml of kern-web-proxy and changed the ${...} properties to version number. And now maven is fetching webmvc:jar:4.2.2 from central repo instead of my local repo.
How can i say to maven to it should look into my local repo(.m2) first then to the central repo?
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the default behavior of maven. It looks in local repo first before checking the remote repo
 
tinku verma
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:That's the default behavior of maven. It looks in local repo first before checking the remote repo


I have solved the last error and i replaced the version number with ${..} then i also got success. I resolved the previous error as well.
sir, many many thanks for your help and time given to my question.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!