Jonah Jordan
Jonah Jordan

Reputation: 33

Dependency issues in deploying war using openshift

I'm facing problems when I'm trying to deploy my war file to the openshift repository.

The error is:

Could not resolve dependencies for project ... the following artifacts could not be found:

All these external jar's are included in the WEB-INF folder of my project and I've also tried to add a local repository but still no luck.

Can anyone help me with this please?

Image of error

here is my 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>SussolWebservice</groupId>
  <artifactId>SussolWebservice</artifactId>
  <version>ROOT</version>
  <packaging>war</packaging>
  <properties>
    <spring.version>4.0.1.RELEASE</spring.version>
 </properties>
  <dependencies>

      <dependency>
     <groupId>junit</groupId>
     <artifactId>junit</artifactId>
     <version>4.12</version>
     <scope>test</scope>
    </dependency>

   <!-- Spring dependencies -->
   <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>${spring.version}</version>
  </dependency>

 <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-web</artifactId>
   <version>${spring.version}</version>
 </dependency>

 <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>${spring.version}</version>
 </dependency>
 <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.13</version>
 </dependency>
 <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.5.3</version>
</dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
	  <artifactId>commons-io</artifactId>
      <version>1.4</version>
    </dependency>
    <dependency>
   <groupId>commons-fileupload</groupId>
   <artifactId>commons-fileupload</artifactId>
   <version>1.2.2</version> <!-- makesure correct version here -->
</dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.2.3</version>
    </dependency>
  
   
    <dependency>
      <groupId>org.eclipse.jdt.core.compiler</groupId>
      <artifactId>ecj</artifactId>
      <version>4.4.2</version>
    </dependency>

    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
</dependency>
 <dependency>
         <groupId>weka</groupId>
         <artifactId>weka</artifactId>
         <scope>system</scope>
         <version>1.0</version>
         <systemPath>${basedir}\WebContent\WEB-INF\lib\weka.jar</systemPath>
    </dependency>
    <dependency>
         <groupId>opencsv</groupId>
         <artifactId>opencsv</artifactId>
         <scope>system</scope>
         <version>1.0</version>
         <systemPath>${basedir}\WebContent\WEB-INF\lib\opencsv-3.7.jar</systemPath>
    </dependency>
    <dependency>
         <groupId>logging</groupId>
         <artifactId>logging</artifactId>
         <scope>system</scope>
         <version>1.0</version>
         <systemPath>${basedir}\WebContent\WEB-INF\lib\slf4j-log4j12-1.7.1.jar</systemPath>
    </dependency>
    <dependency>
         <groupId>log</groupId>
         <artifactId>log</artifactId>
         <scope>system</scope>
         <version>1.0</version>
         <systemPath>${basedir}\WebContent\WEB-INF\lib\slf4j-api-1.7.1.jar</systemPath>
    </dependency>
    <dependency>
         <groupId>loggger</groupId>
         <artifactId>logger</artifactId>
         <scope>system</scope>
         <version>1.0</version>
         <systemPath>${basedir}\WebContent\WEB-INF\lib\log4j-1.2.17.jar</systemPath>
    </dependency>
    <dependency>
         <groupId>packagemgr</groupId>
         <artifactId>packagemgr</artifactId>
         <scope>system</scope>
         <version>1.0</version>
         <systemPath>${basedir}\WebContent\WEB-INF\lib\packageManager.jar</systemPath>
    </dependency>
    <dependency>
         <groupId>SOM</groupId>
         <artifactId>SOM</artifactId>
         <scope>system</scope>
         <version>1.0</version>
         <systemPath>${basedir}\WebContent\WEB-INF\lib\SelfOrganizingMap.jar</systemPath>
    </dependency>
  </dependencies>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

Upvotes: 1

Views: 348

Answers (1)

Tristan Van Poucke
Tristan Van Poucke

Reputation: 343

I have checked your pom and found some dependencies with scope system, which means your JDK or container provides those jar's at a location you provide in the pom.

From the documentation:

system This scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository.

provided

This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.

More information here:

https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope

It is very likely openshift has no files like those provided as systempath's in your POM.

You can do one of the following:

  1. Remove scope & system path from you depedencies, this way the default (Compile) scope will be used and those jar's will be included in your project.
  2. Store the jar files you need in a folder on your openshift server (app-root/data, for example) and refer to that folder in your pom.
  3. If you are using Tomcat, and all your applications running on this Tomcat are using the libraries you want to share, you can always store your shared libs in: tomcat-dir/common/lib (don't forget to change your scope to "provided" in this case).

Upvotes: 1

Related Questions