File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Cannot find parent error while Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Cannot find parent error while "mvn compile"" Watch "Cannot find parent error while "mvn compile"" New topic
Author

Cannot find parent error while "mvn compile"

Sainadh Komaravolu
Greenhorn

Joined: Jan 31, 2010
Posts: 6
Hi All,

I am new to Maven, and i was trying to compile the source packages. I am encountering this error . I tried to solve, but my attempts were unsuccessful.

Error log starts
-------------------------------

+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building basic
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] Copying 2 resources
[INFO] Copying 0 resource
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: org.sonatype.gossip:gossip:jar:1.2

Reason: Cannot find parent: org.sonatype.forge:forge-parent for project: org.sonatype.gossip:gossip:jar:1.2 for project org.sonatype.gossip:gossip:jar:1.2


[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Unable to get dependency information: Unable to read the metadata file for artifact 'org.sonatype.gossip:gossip:jar': Cannot find parent: org.sonatype.forge:forge-parent for project: org.sonatype.gossip:gossip:jar:1.2 for project org.sonatype.gossip:gossip:jar:1.2
org.sonatype.gossip:gossip:jar:1.2

from the specified remote repositories:
java.net (http://download.java.net/maven/2/),
forge-snapshots (http://repository.sonatype.org/content/repositories/snapshots/),
codehaus (http://repository.codehaus.org),
openehealth.snapshots (http://repo.openehealth.org/maven2/snapshots),
codehaus nexus (https://nexus.codehaus.org/content/repositories/releases/),
jboss (http://repository.jboss.com/maven2),
codehaus.org (http://snapshots.repository.codehaus.org),
central (http://repo1.maven.org/maven2),
codehaus-nexus-snapshots (https://nexus.codehaus.org/content/repositories/snapshots/),
openehealth.releases (http://repo.openehealth.org/maven2/releases),
hapi-sf (http://hl7api.sourceforge.net/m2)

Path to dependency:
1) org.codehaus.gmaven:gmaven-plugin:maven-plugin:1.3
2) org.codehaus.gmaven.runtime:gmaven-runtime-loader:jar:1.3


at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:576)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:500)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:479)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:292)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:345)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:132)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:290)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.artifact.resolver.ArtifactResolutionException: Unable to get dependency information: Unable to read the metadata file for artifact 'org.sonatype.gossip:gossip:jar': Cannot find parent: org.sonatype.forge:forge-parent for project: org.sonatype.gossip:gossip:jar:1.2 for project org.sonatype.gossip:gossip:jar:1.2
org.sonatype.gossip:gossip:jar:1.2

from the specified remote repositories:
java.net (http://download.java.net/maven/2/),
forge-snapshots (http://repository.sonatype.org/content/repositories/snapshots/),
codehaus (http://repository.codehaus.org),
openehealth.snapshots (http://repo.openehealth.org/maven2/snapshots),
codehaus nexus (https://nexus.codehaus.org/content/repositories/releases/),
jboss (http://repository.jboss.com/maven2),
codehaus.org (http://snapshots.repository.codehaus.org),
central (http://repo1.maven.org/maven2),
codehaus-nexus-snapshots (https://nexus.codehaus.org/content/repositories/snapshots/),
openehealth.releases (http://repo.openehealth.org/maven2/releases),
hapi-sf (http://hl7api.sourceforge.net/m2)

Path to dependency:
1) org.codehaus.gmaven:gmaven-plugin:maven-plugin:1.3
2) org.codehaus.gmaven.runtime:gmaven-runtime-loader:jar:1.3


at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:432)
at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:437)
at org.apache.maven.artifact.resolver.DefaultArtifactCollector.collect(DefaultArtifactCollector.java:74)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:300)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:288)
at org.apache.maven.plugin.DefaultPluginManager.ensurePluginContainerIsComplete(DefaultPluginManager.java:773)
at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:607)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:432)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
... 16 more
Caused by: org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException: Unable to read the metadata file for artifact 'org.sonatype.gossip:gossip:jar': Cannot find parent: org.sonatype.forge:forge-parent for project: org.sonatype.gossip:gossip:jar:1.2 for project org.sonatype.gossip:gossip:jar:1.2
at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:183)
at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedArtifact(MavenMetadataSource.java:91)
at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:388)
... 24 more
Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find parent: org.sonatype.forge:forge-parent for project: org.sonatype.gossip:gossip:jar:1.2 for project org.sonatype.gossip:gossip:jar:1.2
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1377)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:820)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:252)
at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:154)
... 26 more
Caused by: org.apache.maven.project.InvalidProjectModelException: Not a v4.0.0 POM. for project org.sonatype.forge:forge-parent at D:\.m2\repository\org\sonatype\forge\forge-parent\5\forge-parent-5.pom
at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1580)
at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1552)
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:559)
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1373)
... 29 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed May 04 11:01:14 IST 2011
[INFO] Final Memory: 13M/254M
[INFO] ------------------------------------------------------------------------

-----------------------------------
Error log ends

Kindly help.

Regards,
Sainadh.
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

Look at your project "pom.xml" it should have a dependency to the gossip jar... your .m2 repository should contain the 'jar' file if you are compiling the project in offline mode or the best way is to configure your settings.xml to connect online and download the jars.

you can find the jar here and the forge-parent jar version 5here


Time is what we want the most, but what we use the worst. -- William Penn
Sainadh Komaravolu
Greenhorn

Joined: Jan 31, 2010
Posts: 6
Dear John,

I am working with Maven in online mode and my pom.xml is not having gossip.jar dependency. I have added it in the dependencies list

<dependencies>
<dependency>
<groupId>org.openehealth.ipf.platform-camel</groupId>
<artifactId>platform-camel-core</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.sonatype.gossip</groupId>
<artifactId>gossip</artifactId>
<version>1.2</version>
</dependency>
</dependencies>

But still i face the same problem John...

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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>org.openehealth.tutorial</groupId>
<artifactId>basic</artifactId>
<name>basic</name>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.openehealth.ipf</groupId>
<artifactId>ipf</artifactId>
<version>2.2.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.openehealth.ipf.platform-camel</groupId>
<artifactId>platform-camel-core</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.sonatype.gossip</groupId>
<artifactId>gossip</artifactId>
<version>1.2</version>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<!-- This seems to be the only way to add the .groovy source files -->
<!-- in src/main/groovy to the Eclipse build path. -->
<!-- The source files have to be excluded binaries explicitly (see maven-jar-plugin config). -->
<directory>src/main/groovy</directory>
</resource>
<resource>
<directory>.</directory>
<includes>
<include>META-INF/**/*</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<id>generateStubs</id>
<phase>process-resources</phase>
<goals>
<goal>generateStubs</goal>
</goals>
</execution>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<projectnatures>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
<projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>
</projectnatures>
<downloadSources>true</downloadSources>
<ajdtVersion>none</ajdtVersion>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<!-- Add explicitly the groovy libs. Groovy nature alone seems not to be enough. -->
<classpathContainer>GROOVY_SUPPORT</classpathContainer>
</classpathContainers>
</configuration>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>openehealth.releases</id>
<name>Open eHealth Maven Repository</name>
<url>http://repo.openehealth.org/maven2/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>openehealth.snapshots</id>
<name>Open eHealth Maven Repository</name>
<url>http://repo.openehealth.org/maven2/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>codehaus nexus</id>
<name>Codehaus Nexus Maven Repository</name>
<url>https://nexus.codehaus.org/content/repositories/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>codehaus</id>
<name>Codehaus Maven Repository</name>
<url>http://repository.codehaus.org</url>
</repository>
<repository>
<id>java.net</id>
<name>java.net Maven Repository</name>
<url>http://download.java.net/maven/2/</url>
</repository>
<repository>
<id>jboss</id>
<name>JBoss Maven Repository</name>
<url>http://repository.jboss.com/maven2</url>
</repository>
<repository>
<id>hapi-sf</id>
<name>HAPI Sourceforge Repository</name>
<url>http://hl7api.sourceforge.net/m2</url>
</repository>
</repositories>

</project>


Thanks for help.

Regards,
Sainadh.
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

What about the forge-parent ? do you have a directory in your repository for that with the pom files ?
Sainadh Komaravolu
Greenhorn

Joined: Jan 31, 2010
Posts: 6
John,

Yes i have forge-parent folder under "\.m2\repository\org\sonatype\forge".

Please look into this modified pom.xml

----------------------------------------------------





Thanks for support John...

Regards,
Sainadh.
Sainadh Komaravolu
Greenhorn

Joined: Jan 31, 2010
Posts: 6
John,

Is there something wrong with the POM itself ???

Because.. if i change the gossip version as some 1.XX, the error code still says gossip:jar:1.2 is not found in forge-parent.

Kindly suggest me a way to resolve this issue.

Thanks,
Sainadh.
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

did it work ?

Note: You can remove the forge-parent dependency, its included by the gossip jar ( look at the pom.xml of gossip ), If you have all the jars then you shouldn't get any problem.. is your location of your repository correct in settings.xml ?
Sainadh Komaravolu
Greenhorn

Joined: Jan 31, 2010
Posts: 6
No John.....
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

Well, why dont you debug?

Include the dependencies one by one and try to compile.. see where are you getting the error... (ignore the compilation errors due to removed dependencies) look for the exact error you are getting now..
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

Also try running with the -X option - that will print out a lot more information about what Maven is doing. If you can't figure it out from that, redirect the output for running with -X to a file and attach that file to a post (don't post the text itself - it will be way to long).


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot find parent error while "mvn compile"