0

I have two different maven projects - let's say ProjectA and ProjectB where ProjectA uses ProjectB.

These projects have seperate pom.xml files. I would like to create a dependancy inside the pom.xml of ProjectA and include ProjectB.

However, everytime I try to run as clean install it always fails and shows the following error.

[WARNING] The POM for database-manager:database-manager:jar:0.0.1-SNAPSHOT is missing, no dependency information available

[ERROR] Failed to execute goal on project cumulus-certificate-generator-attestation: Could not resolve dependencies for project database-manager:database-manager:jar:0.0.1-SNAPSHOT: Could not find artifact cdatabase-manager:cdatabase-manager:jar:0.0.1-SNAPSHOT -> [Help 1]

where database-manager = ProjectB.

My dependency (inside ProjectA pom.xml) looks like this:

<dependency>
    <groupId>database-manager</groupId>
    <artifactId>database-manager</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <scope>compile</scope>
</dependency>

I want to mention that I found a solution by including a "master" pom.xml that will include these two projects but this is not the solution as I have multiple pom.xml files and multiple projects. If this question has already been answered, can you please point me the solution as I cannot find anything similar to this.

<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>database-manager</groupId>
  <artifactId>database-manager</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>database-manager</name>

Thanks!

  • can you post the GAV of projectB? is the group and artifactId correct? – Sridhar Sep 18 '18 at 16:50
  • @Sridhar Hi, I've added ProjectB pom.xml. – Mike M. Kaspin Sep 18 '18 at 16:53
  • 1
    the error says it could not find artifact. It means the expected jar file does not exists in your local maven repository. ie. `/.m2/`. If it is true, try `clean install` projectB first and check it creates jar in the `.m2` folder. Other option, if you are using `eclipse`, try to re-index or use the `maven run configuration` window, check the `Resolve workspace dependencies` option. This may help https://stackoverflow.com/questions/10688344/in-eclipse-m2e-how-to-reference-workspace-project – Sridhar Sep 18 '18 at 16:57

1 Answers1

0

First: - just read error message more carefully:

cumulus-database-manager:cumulus-database-manager:jar:0.0.1-SNAPSHOT

This is dependency which missed not your database-manager:database-manager

Your projectB database-manager has it.

When dependency missed - it means as @Sridhar said it is not in <your home directory>/.m2/repository folder and as well as it cannot be downloaded from any defined remote repositories.

if cumulus-database-manager is valid dependency

I assume you have to see at the beginning of Maven output, some messages like downlading artifact ... from ...<url> and then cannot be downloaded message.

In this case you will get cumulus-database-manager/cumulus-database-manager direcotry in your locam .m2/repository, but with no jar file in it.

Try to delete cumulus-database-manager directory from .m2/repository and run again to force Maven try to download it again and look at messages why it was not downloaded...

BTW if you need to build at the same time two projects when one depends on another - you have to have "master" pom, with both projects defined in modules element. Otherwise you have to build one after another manually, at least for the first time.

Vadim
  • 4,027
  • 2
  • 10
  • 26
  • Thank you for you prompt answer. I tried to enable all the dependencies in all the different projects but 'clean install' keeps failing. However, I do not see any message downloading artifact as you mention I should. – Mike M. Kaspin Sep 18 '18 at 20:07
  • You need to go through missing dependencies one by one, check .m2/repository for them, delete directories accordingly if there are no jar files. Maybe you need to setup your remote repositories (and or proxy) in your .m2/settings.xml file or directly in the project pom.xml. BTW keep in mind .m2/repository structure follows groupId:artifactId:version structure. e.g. for artifafact `org.apache.commons:commons-lang3:3.7` jar file is in `.m2/repository/org/apache/commons/commons-lang3/3.7` directory. Sorry There is no other way... – Vadim Sep 18 '18 at 20:31
  • The problem is that I cannot see any of the project dependencies in the .m2/repository/. It normally downloads the internal and external jars but when it comes to the different projects it does nothing. If I undrestand correctly, It tries to build the project for the first time but since it cannot download the dependencies, it fails, thus it never creates the corresponding dependencies in .m2. Do you have any suggestion for this? – Mike M. Kaspin Sep 18 '18 at 20:35