0

enter image description hereI found this crazy issue in my eclipse. I'm able to run the Maven build with the command "maven clean package" in command prompt. But however when I try to build the same in eclipse by doing right click-> run as -> Maven build, In the configuration I've added as "clean package". It is throwing me the error of

The project com.svu.core:cUT:1.0.0-SNAPSHOT (E:\CU-SVN\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM: Failure to find com.zenmonics.core:epom:pom:1.0.0 in 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 and 'parent.relativePath' points at wrong local POM @ line 11, column 10 -> [Help 2]

It has the same error in POM.xml, but how is it running from command prompt but not from eclipse IDE. Due to this I'm not able to get Maven dependencies in my Build path.

<project xmlns="http://maven.apache.org/POM/4.0.0" x mlns: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.svu.core</groupId>-->
<artifactId>cUT</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>pom :: cUT</name>
<packaging>pom</packaging>

<parent> <---------- Here it throws error 
    <groupId>com.svu.core</groupId>
    <artifactId>epom</artifactId>
    <version>1.0.0</version>
</parent>

enter image description here

Syed
  • 2,471
  • 10
  • 49
  • 89

7 Answers7

1

You might be using embedded maven inside eclipse.

You can try using the same maven set up that you are using on your system.

go to -->

Window >> preferences >> maven >> installations

Here in - add a new installation and give the path till bin folder of maven libraries.

Try using this approach - it should work , if your maven commands are working fine from command prompt.

Ashish Shetkar
  • 1,414
  • 2
  • 18
  • 35
0

Please check your workspace whether maven repository exist or not exist..!

Zay Ya
  • 195
  • 1
  • 4
  • 15
  • .m2 folder exists in my system under c drive & repository also exists under it – Syed Jun 15 '16 at 04:53
  • I mean your eclipse workspace.! not your system drive..! If there is exits maven repository in your workspace, you can build maven project in your eclipse – Zay Ya Jun 15 '16 at 04:57
  • How to check that? – Syed Jun 15 '16 at 05:10
  • Please take the reference in this link http://stackoverflow.com/questions/10235374/how-to-change-maven-local-repository-in-eclipse – Zay Ya Jun 15 '16 at 05:14
  • That is just showing the settings.xml location right? and its the same in my project too – Syed Jun 15 '16 at 05:17
  • Yes, you need to change your maven repository location in settings.xml – Zay Ya Jun 15 '16 at 05:27
  • Updated with screenshot of installations tab under preferences, but I dont have settings.xml under .m2 folder – Syed Jun 15 '16 at 05:32
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/114690/discussion-between-syed-and-zay-ya). – Syed Jun 15 '16 at 05:36
0

Please try to put your pom.xml. Your error says that the problem is in pom.xml @ line 11, column 10.

The problem is the parent pom is not detected in your current pom. Try the following

<project>

  <parent>
    <groupId>com.svu.core</groupId>
    <artifactId>epom</artifactId>
    <version>1.0.0</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.svu.core</groupId>         <--- Same group id as your parent
  <artifactId>cUT</artifactId>


Reference: http://maven.apache.org/guides/introduction/introduction-to-the-pom.html

Note: I dont have enough reputation to comment in your question.

programmer
  • 96
  • 1
  • 2
  • 11
0

When following is working

cd cUT
mvn compile

but the same module cannot be compile in Eclipse. Probably you have changed the Maven config and the Eclipse view of it is not up-to-date anymore. This can happen for exmaple if you change a pom.xml file outside Eclipse or at a place which is not considered as to be in the project path (see your other question).

Select in the Project Explorer in Eclipse the module cUT. Press ALT-F5 (executes maven -> update project). Select all modules of your project, check that update project configuration from pom.xml is enabled and click on òk` to process.

Community
  • 1
  • 1
SubOptimal
  • 22,518
  • 3
  • 53
  • 69
  • Can you please elaborate "but the same module cannot be compile in Eclipse. Probably you have changed the Maven config and the Eclipse view of it is not up-to-date anymore.".. I'm not able to understand it – Syed Jun 15 '16 at 06:14
  • I didn't change anything in config.. My settings.xml was missing under .m2 folder, is this could be the reason for not getting the maven dependencies? – Syed Jun 15 '16 at 06:15
  • @Syed The `settings.xml` is not a mandatory file. For the other question have a look into my updated answer. Is in any of your `pom.xml` a reference to `com.zenmonics.core`? How does the `pom.xml` of your parent module `epom` look like? – SubOptimal Jun 15 '16 at 06:31
  • For later readers I mean `settings.xml is not a mandatory file` in **.m2** directory. ;-) – SubOptimal Jun 15 '16 at 11:04
0

I had the same exact problem, everything was working on eclipse Mars, but I switched to Eclipse Oxygen and all my variables were fine, I checked everywhere.

And suddenly I got into the preferences in eclipse for Maven Installations (where you point to the Maven directory) and just got rid of the forward slash at the end of the path and it worked!

Basically:

Change C:\Program Files\apache-maven_3.5.3\

to

C:\Program Files\apache-maven_3.5.3

And it worked!

0

The difference between building from command line and eclipse is the variables. Like:

  • the java path in case you have more than one jdk. The command line will pick from java home where as in eclipse you can configure which jdk to use.

  • settings.xml can also be different. I think this is the problem in your case. Command line picks the settings.xml from the source code directory (if present). This file contains the maven repo url to download all the dependencies. In eclipse you can configure the path for settings.xml. I suspect the path is different in eclipse compared to command line. Please change that in eclipse and it should work. I have faced this issue and this was the root cause. you can see in your logs "Failure to find com.zenmonics.core:epo, which suggests the some problem in the repo url.

0

I have installed latest maven and in the windows -> maven -> installation I have added my latest maven. It started working for me.