Maven Could not resolve dependencies for project MyProject oh - java

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">
<parent>
<artifactId>deephitomi</artifactId>
<groupId>studio.deepsea</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>studio.deepsea</groupId>
<artifactId>deephitomi-client</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>studio.deepsea</groupId>
<artifactId>deephitomi-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.4.RELEASE</version>
</dependency>
</dependencies>
deephitomi-common 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">
<parent>
<artifactId>deephitomi</artifactId>
<groupId>studio.deepsea</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>studio.deepsea</groupId>
<artifactId>deephitomi-common</artifactId>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>4.3.10.RELEASE</spring.version>
<jackson.version>2.5.3</jackson.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</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-tx</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-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<!-- 使用SpringMVC需配置 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- 关系型数据库整合时需配置 如hibernate jpa等 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.4</version>
</dependency>
<!-- log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- mysql连接 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.34</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.18</version>
</dependency>
<!-- json -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- aop -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.4</version>
</dependency>
<!-- servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0-alpha-1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<!-- 上传文件 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.13.Final</version>
</dependency>
</dependencies>
ERROR:
[ERROR] Failed to execute goal on project deephitomi-client: Could not resolve dependencies for project studio.deepsea:deephitomi-client:jar:1.0-SNAPSHOT: Failed to collect dependencies at studio.deepsea:deephitomi-common:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for studio.deepsea:deephitomi-common:jar:1.0-SNAPSHOT: Could not find artifact studio.deepsea:deephitomi:pom:1.0-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
For me a time in the afternoon orz...
add deephitomi 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>studio.deepsea</groupId>
<artifactId>deephitomi</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>deephitomi-client</module>
<module>deephitomi-server</module>
<module>deephitomi-common</module>
<module>deephitomi-core</module>
<module>deephitomi-web</module>
</modules>

You have a project structured like this:
deephitomi
deephitomi-common
deephitomi-client
...
It seems you were running mvn test inside deephitomi-client.
When you do that,
Maven tries to find its dependency deephitomi-common in a repository.
It doesn't know that deephitomi-common is in a sibling directory,
it only looks at Maven repositories.
To be able to run mvn test inside deephitomi-client,
you can install deephitomi-common in your local Maven repository.
Run this inside deephitomi, the project root directory:
mvn install
After this, you will be able to run mvn test inside deephitomi-client:
cd deephitomi-client
mvn test
Note that if you make any changes to deephitomi-common that you want to use by deephitomi-client, then you need to repeat the mvn install step.

Related

Could not resolve dependencies for project. Could not find artifact.

I have a problem with building a project Farma-rest which depends on my other project Farma. I put dependency in my pom.xml but it couldn't resolve dependencies for the project. It shows me this error message:
Failed to execute goal on project Farma-rest: Could not resolve dependencies for project sk.upjs.ics:Farma-rest:jar:1.0-SNAPSHOT: Could not find artifact sk.upjs.ics:Farma:jar:1.0-SNAPSHOT -> [Help 1]
Here is the pom of the first 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>
<groupId>sk.upjs.ics</groupId>
<artifactId>Farma</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.8-dmr</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<scope>test</scope>
<version>2.44.0</version>
</dependency>
<dependency>
<groupId>com.opera</groupId>
<artifactId>operadriver</artifactId>
<scope>test</scope>
<version>1.5</version>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
And here is the POM of the project which I want to build:
<?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>sk.upjs.ics</groupId>
<artifactId>Farma-rest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.8-dmr</version>
</dependency>
<dependency>
<groupId>sk.upjs.ics</groupId>
<artifactId>Farma</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- <scope>compile</scope>-->
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310 -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.9.3</version>
</dependency>
</dependencies>
</project>
I tried to clean and build the project but it didn't helped.
The jar for the Farma project is not available in your local maven repo.
Check if the ~/.m2/repository/sk.upjs.ics/Farma/1.0-SNAPSHOT directory exists. It should not at this point.
Run the build for the Farma project. Maven should create the artifact and put it in your local maven repository.
Check the same directory as before. It should now exist and it should have a jar and pom in it.
Now try building Farma-rest again and it should work.

"Forbidden" Response when trying to access localhost:8080 - Spring, Maven, Eclipse, Hibernate, WildFly

Any help appreciated!
I had this working a day ago, I get the feeling that it's a maven problem but I'm not sure how to fix it.
Running Maven gives a build error :
No compiler is provided in this environment. Perhaps you are running
on a JRE rather than a JDK?
And also this compilation error :
Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
(default-compile) on project FYP4: Compilation failure
Project Structure :
https://gyazo.com/bce728b6e84ee04aad74e82d3c7fb0fc
Here is the 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>
<groupId>com.DH</groupId>
<artifactId>FYP4</artifactId>
<packaging>war</packaging>
<version>1</version>
<properties>
<springframework.version>4.0.6.RELEASE</springframework.version>
<hibernate.version>4.3.6.Final</hibernate.version>
<mysql.version>5.1.31</mysql.version>
<joda-time.version>2.3</joda-time.version>
<testng.version>6.9.4</testng.version>
<mockito.version>1.10.19</mockito.version>
<h2.version>1.4.187</h2.version>
<dbunit.version>2.2</dbunit.version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${springframework.version}</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- jsr303 validation -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.1.3.Final</version>
</dependency>
<!-- MySQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- Joda-Time -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-time.version}</version>
</dependency>
<!-- To map JodaTime with database type -->
<dependency>
<groupId>org.jadira.usertype</groupId>
<artifactId>usertype.core</artifactId>
<version>3.0.0.CR1</version>
</dependency>
<!-- Servlet+JSP+JSTL -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- Testing dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${springframework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>${dbunit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<warName>FYP4</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<finalName>FYP4</finalName>
</build>
Try to compile it on the shell and check the mentioned paths in Eclipse:
You should have mvn and javac in your %PATH%. Additionally you can set your JAVA_HOME for example to C:\Program Files\Java\jdk1.8.0_144
Good screenshots of the Eclipse and Windows settings are already shown here
If you are building in Eclipse then make sure you are using a JDK to build and not a JRE.
Goto: Window -> Preferences -> Java -> Installed JREs
Then: Verify you are using a JDK and not a JRE.

Elasticsearch Java API Error: java.lang.NoSuchMethodError: com.carrotsearch.hppc.ObjectHashSet.equals(Ljava/lang/Object;Ljava/lang/Object;)Z

I am trying to connect to Elasticsearch using Java. Here is the part of my code:
private static TransportClient client = null;
public BooleanQuery() {
try {
client = new PreBuiltTransportClient(Settings.EMPTY);
client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
When I run this program, I am getting the below exception:
Exception in thread "main" java.lang.NoSuchMethodError: com.carrotsearch.hppc.ObjectHashSet.equals(Ljava/lang/Object;Ljava/lang/Object;)Z
at com.carrotsearch.hppc.ObjectHashSet.add(ObjectHashSet.java:159)
at com.carrotsearch.hppc.ObjectHashSet.addAll(ObjectHashSet.java:189)
at com.carrotsearch.hppc.ObjectHashSet.from(ObjectHashSet.java:544)
at org.elasticsearch.index.mapper.MapperService.<clinit>(MapperService.java:101)
at org.elasticsearch.common.settings.IndexScopedSettings.<clinit>(IndexScopedSettings.java:60)
at org.elasticsearch.common.settings.SettingsModule.<init>(SettingsModule.java:69)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:138)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:265)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:130)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:116)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:106)
at com.accenture.poc.elasticsearch.BooleanQuery.<init>(BooleanQuery.java:29)
at com.accenture.poc.DataProcessor.main(DataProcessor.java:134)
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>com.accenture</groupId>
<artifactId>poc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>poc</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>info.debatty</groupId>
<artifactId>java-string-similarity</artifactId>
<version>RELEASE</version>
</dependency>
<!-- Dependencies of Wiki -->
<!-- https://mvnrepository.com/artifact/org.fusesource.jdbm/jdbm -->
<dependency>
<groupId>org.fusesource.jdbm</groupId>
<artifactId>jdbm</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.bluestemsoftware.open.maven.tparty</groupId>
<artifactId>xerces-impl</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-compress</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-loader-hbase</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- Elasticsearch dependency -->
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.9.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.1</version>
</dependency>
</dependencies>
</project>
The error is pointing to the line "client = new PreBuiltTransportClient(Settings.EMPTY);". I'm not sure what it means? I didn't find anything online related to this. Any help is appreciated.
Running an mvn dependency:tree -Dverbose reveals that there are 2 versions of com.carrotsearch:hppc:jar, (0.4.2, 0.7.1). The latter one comes with the addition of the elasticsearch dependencies. The first one comes from org.apache.marmotta:marmotta-loader-hbase:jar.
So I suspect that you have both versions of hppc.jar in your build, because by the time you added the elastic search dependencies you did not perform a clean (mvn clean).
So try clean building your project again and try again:
mvn clean package

I have added dependency in Pom.xml but Maven is not picking up, maven build gets fails

I need to use gson jar for saving a POJO file to java.For this I added its dependency in Pom.xml
I have this jar in my local m2 repository
But in import statement I am getting this error
I did update project and clean project but didn't resolved the issue.
I then added this jar through add external jar
With this the compilation error got resolved
But when I do Maven install and Maven build it gets failed, the error I am getting is:
It is giving error on import statement, for Gson.
Adding the updated pom.xml
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>
<parent>
<artifactId>parent</artifactId>
<groupId>configurator</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-pom/pom.xml</relativePath>
</parent>
<groupId>com.csc.fs.accel.browser</groupId>
<artifactId>com.csc.fs.accel.browser.dictionary.rest</artifactId>
<packaging>bundle</packaging>
<name>com.csc.fs.accel.browser.dictionary.rest Blueprint Bundle</name>
<description>com.csc.fs.accel.browser.dictionary.rest OSGi blueprint bundle project.</description>
<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.csc.fs.accel.browser</groupId>
<artifactId>com.csc.fs.accel.browser.dictionary.service</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.emf.common</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.emfjson</groupId>
<artifactId>emfjson-jackson</artifactId>
<version>0.9.0</version>
</dependency> -->
<dependency>
<groupId>org.eclipselabs</groupId>
<artifactId>org.eclipselabs.emfjson</artifactId>
<version>0.8.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs</groupId>
<artifactId>com.csc.fs.storage.service</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.pa</groupId>
<artifactId>com.csc.fs.pa.common.exception</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.pa</groupId>
<artifactId>com.csc.fs.pa.common.service</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.accel</groupId>
<artifactId>com.csc.fs.accel.etools.datadictionary.model</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.accel</groupId>
<artifactId>com.csc.fs.accel.etools.common.usability.api</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.accel</groupId>
<artifactId>com.csc.fs.accel.etools.common.model</artifactId>
<version>2.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.xsd</groupId>
<artifactId>xsd</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
<dependency>
<groupId>com.csc.fs.pa</groupId>
<artifactId>
com.csc.fs.pa.allowedValue.service
</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>com.csc.fs.accel.browser.dictionary.rest*;version=${project.version}</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.csc.fs.accel</groupId>
<artifactId>
com.csc.fs.accel.etools.datadictionary.model
</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.accel</groupId>
<artifactId>com.csc.fs.accel.etools.common.usability.api</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.accel</groupId>
<artifactId>
com.csc.fs.accel.etools.common.model
</artifactId>
<version>2.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Can anyone please suggest what I am missing or how should i resolve this error
You got wrong dependency declared. It should be
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>
while your groupId is <groupId>com.google.code.gson.gson</groupId> - notice double .gson at the end.
UPDATE:
So as you have pasted your POM now we can see what is the problem.
You have given dependency (gson) in Dependency Managemet not in Dependencies. You have to include it in Dependencies as well. To understand what dependency management is, read mavens doc https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

MyEclipse does not deploy jars into WEB-INF/lib directory

I import an existing Maven project into Eclipse,and i deployed it into tomcat.When I took a glance at the folder /WEB-INF/lib I have found no JAR files.
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bookshop.main</groupId>
<artifactId>BookShop</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<properties>
<spring.version>4.0.5.RELEASE</spring.version>
<junit.version>4.11</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>4.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>4.0.1.RELEASE</version>
</dependency>
</dependencies>
<build>
<finalName>BookShop</finalName>
</build>
</project>
quote "eclipse project right click -> Properties -> Deployment Assembly -> Add -> Java Build Path",it's not help.
Do you have an idea?Thanks.
btw:i also got the following error messages when i redeploy it:
could not be redeployed because it could not be completely removed in the undeployment phase.
the Error is:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
I don't see such an artifact in a maven repository.Sorry.

Categories

Resources