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>
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:
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.
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.
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).
Related
I'm trying to implement my own jar (library) in another project I'm working on. But I'm getting the error NoClassDefFoundError when I run the program and try to instantiate a class from the library I built.
I try to add the dependency in different ways, with maven local repo or adding the jar file directly as an external jar in Build Path. I don't get any warning/error in eclipse and I can build and install the app with maven successfully. But when I execute the part of the code that use a class from that library I get NoClassDefFoundError.
My library groupId is com.mycompany.myapp, and the classes I'm using are in the package com.mycompany.myapp.business. I'm try to move the class to the parent package just in case but I'm always getting the same error.
1 - Do I need to define which classes need to be available when importing the jar?
2- Do I need to compile the library in an specific way apart from mvn clan package/install?
3 - Do I need to add the same dependencies I have in my library in my parent project to have everything working?
This is my children 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>com.mycompany.mylibrary</groupId>
<artifactId>mylibrary</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.5</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>javax.xml.rpc</groupId>
<artifactId>javax.xml.rpc-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.47</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.47</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javax.xml.rpc</groupId>
<artifactId>javax.xml.rpc-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.0-M1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.5.0-M1</version>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.3.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</project>
And then in my main project I instantiate the class in the following way:
Init oInit = new Init();
Where Init is a public class defined in com.mycompany.mylibrary.business package.
java.lang.NoClassDefFoundError: com/mycompany/mylibrary/business/Init
pom.xml from the main proyect:
<dependency>
<groupId>com.mycompany.mylibrary</groupId>
<artifactId>mylibrary</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
In the parent project, in the libraries imported by maven I see that my library has a folder icon instead of the one the other have.
You can use the two ways to include a library into your project:
Including the library directly into your project classpath
Through Maven
When using the Maven option, you must be sure that the library is well exported to the Maven repository, local or remote (such as Nexus). The first place Maven will search when looking for a library defined in the pom.xml is on your local repository (located at ~/.m2). The it will look into the Central Maven Repository (located at https://mvnrepository.com/repos/central). In between, you can declare your own repositories into your pom.xml as
<repositories>
<repository>
<id>my-repo</id>
<name>My Maven Repository</name>
<url>${nexus.repositories.url}</url>
</repository>
<repositories>
How to build the library to be included into your own local or remote repository? Just be sure to include the install goal when compiling with Maven, and also the repository definition into its pom.xml
Scenario
I am trying to add server's servlet-api into my existing Dynamic Web Application after reading BalusC's answer on this post.
So from start in am using maven dependency for my project
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
After reading the BalusC's answer I removed the javax.servlet dependency from pom.xml and I added *Target Runtime into my project.
*
Problem
After this all the errors (in eclipse's window) have gone. But when I try to maven clean install it gives [ERROR] COMPILATION ERROR : package javax.servlet does not exist.
But again if I added the javax.servlet's dependency in pom.xml then it works fine.
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>IncidentManagement</groupId>
<artifactId>IncidentManagement</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src.main.java</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<java.version>1.8</java.version>
<junit.version>4.12</junit.version>
<servlet.version>3.1.0</servlet.version>
<mojarra.version>2.2.12</mojarra.version>
<primefaces.version>5.3</primefaces.version>
<maven.compiler.plugin.version>3.3</maven.compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>JBoss repository</id>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<!-- ORACLE database driver -->
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.3.Final</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
<!-- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency> -->
<!-- Mojarra JSF -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${mojarra.version}</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>${mojarra.version}</version>
</dependency>
<!-- PrimeFaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>${primefaces.version}</version>
</dependency>
<!-- Excel and CSV -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10-FINAL</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10-FINAL</version>
<type>jar</type>
</dependency>
<!-- PDF -->
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
<!-- JSON -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<!-- Primefaces Theme -->
<!-- https://mvnrepository.com/artifact/org.primefaces.extensions/all-themes -->
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.8</version>
</dependency>
</dependencies>
</project>
P.S: I am using Java 8, Apache tomcat 8 and maven 3.
It's quite correct in stating it can't find the class as you don't have it in your pom file...
Having the dependency there as "provided" is correct. At compile time it'll use stubs downloaded from a repository, at runtime it will use the actual classes installed into and provided by the servlet container.
Balus's answer isn't relevant to maven projects, only native Eclipse projects that aren't built externally to Eclipse.
#Junaid, I had the same problem at my workplace. Later I realized that servlet-api.jar file was not the repository provided by workplace. I guess, we are behind the proxy and that downloads the file from local repository than maven. I had to use the j2ee.jar file for the purpose.
I'm trying to build a REST API of web Services I created for my project.
My web services are working without problems.
Now, I want to Deploy my Services on a distant server and I need to generate the war file.
I'm using Java, Eclipse and Maven for dependencies. I tried to make a clean install and the only problem of failure is that :
[WARNING] The artifact jdbc:jdbc:jar:2.0 has been relocated to javax.sql:jdbc-stdext:jar:2.0
[INFO] Downloading: https://repo.maven.apache.org/maven2/javax/sql/jdbc-stdext/2.0/jdbc-stdext-2.0.jar
Could not find artifact javax.sql:jdbc-stdext:jar:2.0 in central (https://repo.maven.apache.org/maven2), try downloading from http://java.sun.com/products/jdbc/download.html
Anyone has a solution ?
P.S : Why i didn't face the problem while testing is because I added the jdbc-stdext-2.0.jar manually and now I'm in troubles.
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>Tech4EarthServices</groupId>
<artifactId>Tech4EarthServices</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<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>
<dependencies>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.17</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.17</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.19</version>
</dependency>
<dependency>
<groupId>jdbc</groupId>
<artifactId>jdbc</artifactId>
<version>2.0</version>
<exclusions>
<exclusion>
<artifactId>jdbc-stdext</artifactId>
<groupId>javax.sql</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.1.7.RELEASE</version>
</dependency>
</dependencies>
You experience the problem because you are including artifacts that have only source packages available. The maven dependency for jdbc.jdbc is referenced as a binary.
Most probably you don't need to include that dependency because those interfaces are provided by the JEE containers that you run your WAR archive in. I would recommend removing the jdbc artifact with the exlusion part entirely.
You can browse as what is available at jdbc/jdbc folder at Maven Central. And indeed the extension for it has removed under javax/sql at Maven Central.
I believe this is because you listed the artifact as an exclusion in your pom. i.e
<exclusions>
<exclusion>
<artifactId>jdbc-stdext</artifactId>
<groupId>javax.sql</groupId>
</exclusion>
</exclusions>
I think if you remove this block you will be fine
As shown in following screenshot - the project SDK and language level are 1.8:
And I went through all of the project modules: they are all likewise defined as 1.8. One of them is shown below:
Yet somehow IJ attached a language level of 1.4 to one of the modules
But actually .. it is not even that straightforward. E.g. the intellisense thinks 1.4:
But when I click on the java.lang.String underlined in red, it DOES go to 1.8:
The pom.xml for the culprit module 'icloud' makes no mention of any java level - so it is not to blame:
<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>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-parent</artifactId>
<version>1</version>
<relativePath>../../parent</relativePath>
</parent>
<artifactId>ignite-cloud</artifactId>
<version>1.1.3-SNAPSHOT</version>
<properties>
<jcloud.version>1.9.0</jcloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-allcompute</artifactId>
<version>${jcloud.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.labs</groupId>
<artifactId>google-compute-engine</artifactId>
<version>${jcloud.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.labs</groupId>
<artifactId>docker</artifactId>
<version>${jcloud.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.provider</groupId>
<artifactId>cloudsigma-zrh</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
I have done Build|Rebuild twice. Also have done
mvn clean package
from command line twice. This is just a big time sink (/waste). So then: why is IJ sabotaging this module - and is there a workaround?
Add a the compiler plugin to pom.xml and reimport the pom will solve this issue
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
The problem was that intellij could not handle the examples subproject being
underneath a parent directory containing the main parent project
but the directory is its own self contained project with no relation to the parent
The workaround is to create an entirely independent project for the examples module.
The other suggested answer - about adding the compiler plugin - made no difference.
i am using jsf2 hibernate 4.1.4, spring 3.1 and maven 3 in eclipse helios. but i have this error when i try to add dependecy in to POM.
Java compiler level does not match the version of the installed Java project facet.
what does it mean? how can i solve this error?
also i have this warning:
Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.
my POM:
<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.integrate</groupId>
<artifactId>integrate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>integrate</name>
<dependencyManagement>
<dependencies>
</dependencies>
</dependencyManagement>
<properties>
<spring.version>3.1.0.RELEASE</spring.version>
</properties>
<dependencies>
<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</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-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- JSF dependencies -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.6</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.6</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- Hibernate dependencies -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.4.Final</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
<!-- oracle Connector dependency -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
<!-- c3p0 dependency -->
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
</dependencies>
the pic:
Just add the build section with the maven-compiler-plugin to your pom.xml.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
Then you should configure project's build path.
Or you can just delete the project from eclipse workspace (without deleting from file system), remove eclipse's settings (.project, .classpath and .settings files and folders) from the project and re-import your project as an existent Maven project to your IDE. Eclipse will re-generate its settings properly.
Please check the project facets concerned with your project(Right click on the project/ Properties/ Project Facets/ Java).
It is just that the java version which you have installed in your system, and the one which you are specifying in the project facets of your project, might not be matching.
Specify the java version for Maven in D:\maven-2.2.1\conf toolchains.xml
<?xml version="1.0" encoding="UTF-8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>1.5</version> <!--This should be same as is configured via the toolchains plugin -->
<vendor>ibm</vendor> <!--This should be same as is configured via the toolchains plugin -->
</provides>
<configuration>
<jdkHome>C:\Program Files\Java\jdk1.5.0</jdkHome>
</configuration>
</toolchain>
</toolchains>
That worked for me:
Project->Java Build Path->Libraries->JRE version
Project->Java Compiler-> Compiler Compliance Level
Project->Project Facets->Java->Version
If you using Maven edit in pom.xml
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>