I have two modules and one links the other one. When I install the second one the build failed saying me 'Could not find artifact'. Here's poms:
<groupId>xyz.upperlevel.graphicengine</groupId>
<artifactId>graphicengine</artifactId>
<packaging>pom</packaging>
<version>FINAL</version>
<modules>
<module>graphicengine-api</module>
<module>gamelauncher</module>
<module>testgame</module>
</modules>
This is the pom of the main project.
Then here's the pom of one of its modules (are all the equal):
<parent>
<groupId>xyz.upperlevel.graphicengine</groupId>
<artifactId>graphicengine</artifactId>
<version>FINAL</version>
</parent>
<groupId>xyz.upperlevel.graphicengine.testgame</groupId>
<artifactId>testgame</artifactId>
<version>1.0-SNAPSHOT</version>
I have the module A that links to the module B all inside the MAIN project. When I build the module A all goes fine (since it has no dependency from local modules) but when I build the module B it failed. This is the error:
Failed to execute goal on project gamelauncher: Could not resolve dependencies for project xyz.upperlevel.graphicengine.gamelauncher:gamelauncher:jar:1.0-SNAPSHOT: Failed to collect dependencies at xyz.upperlevel.graphicengine.api:graphicengine-api:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for xyz.upperlevel.graphicengine.api:graphicengine-api:jar:1.0-SNAPSHOT: Failure to find xyz.upperlevel.graphicengine:graphicengine:pom:FINAL in https://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 -> [Help 1]
How to solve?
Do you use the right coordinates of your artifacts? Maven should have created the repository automatically. See https://maven.apache.org/guides/introduction/introduction-to-repositories.html for more informations on repositories. For a detailed spec for artifacts and dependencies see https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html.
To be able to help you in a better way, please provide some code.
I HAVE SOLVED: I WAS BUILDING FROM MODULES PATH AND INSTEAD OF BUILDING FROM ROOT PROJECT PATH! DON'T FALL IN MY SAME ERROR!
Related
Please find the below logs :
[ERROR] Failed to execute goal on project hospital: Could not resolve dependencies for project
com.project_name.test.web:hospital:war:0.0.1-SNAPSHOT: Failed to collect dependencies at
com.example.test:example-child:jar:1.1.12-SNAPSHOT: Failed to read artifact descriptor for
com.example.test:example-child:jar:1.1.12-SNAPSHOT: Could not transfer artifact
com.example.test:example-parent:pom:1.1.12-SNAPSHOT from/to maven-central
(http://central.maven.org/maven2/): central.maven.org: Unknown host central.maven.org -> [Help 1]
Thanks in advance!
This failes likely due to an artifact downloaded earlier (in my case .m2/repository/org/geotools/geotools/19.1/geotools-19.1.pom) containing this as a specific repo, maybe even retrieved from a thirdparty repo.
Check your local artifacts for references to the repository, e.g. by this brute force approach:
grep -nr "central.maven.org" ~/.m2/repository/
Replacing/removing the dependency solved the issue.
To resolve org.apache.sling.event.jobs,version=[1.5,2] -- Cannot be resolved error in my bundle I added the dependency in the main pom.xml. But when I try to add the same minus the version and scope in the core xml file I am getting a Failed to collect dependencies error.
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.event</artifactId>
<version>4.2.0</version>
<scope>provided</scope>
</dependency>
Error is as follows:
Failed to collect dependencies at org.apache.sling:org.apache.sling.event:jar:4.2.0: Failed to read artifact descriptor for org.apache.sling:org.apache.sling.event:jar:4.2.0: Could not transfer artifact org.apache.sling:org.apache.sling.event:pom:4.2.0 from/to cqblueprints.releases (http://dev.cqblueprints.com/nexus/content/repositories/releases/): Connection refused: connect -> [Help 1]
[ERROR]
The issue, simply, is that the repo you are using: http://dev.cqblueprints.com/nexus/content/repositories/releases/ does NOT have the artifact you are looking for org.apache.sling.event
take a look at http://dev.cqblueprints.com/nexus/content/repositories/releases/org/apache/sling/ I'd expect to see org.apache.sling.event but I don't.
You'll have to add a different repo that has the artifact, maybe Maven central or the Adobe repo.
see this: https://helpx.adobe.com/experience-manager/kb/SetUpTheAdobeMavenRepository.html
Also, the version you are specifying is 4.2.2 you have to check what version is provided by AEM by going to /system/console/bundles and looking for org.apache.sling.event and use that bundle's version.
I am a beginner in using Maven.. I tried to add Grobid (for pdf parsing) in maven. The dependency I gave is :
<dependency>
<groupId>org.grobid</groupId>
<artifactId>grobid-core</artifactId>
<version>0.3.4</version>
</dependency>
But on building the pom it shows the following error:
[ERROR] Failed to execute goal on project Miner: Could not resolve dependencies for project Miner:war:1.0-SNAPSHOT: Failed to collect dependencies at org.grobid:grobid-core:jar:0.3.4 -> org.chasen:crfpp:jar:1.0.2: Failed to read artifact descriptor for org.chasen:crfpp:jar:1.0.2: Could not transfer artifact org.chasen:crfpp:pom:1.0.2 from/to 3rd-party-local-repo (file:///${basedir}/lib/): Repository path /${basedir}/lib does not exist, and cannot be created. -> [Help 1]
I have gone through different questions related..I tried after adding pom etc. Still it is not working.. why this error comes..do we have to do extra codes for Grobid..?
add the below repository in pom or .m2/settings.xml
<repositories>
<repository>
<id>Grobid repository</id>
<url>https://mvnrepository.com/artifact/org.grobid/grobid-core</url>
</repository>
</repositories>
Start by downloading maven from http://mirror.vorboss.net/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip
Unzip it somewhere, then assuming your're on windows
1) set an environment variable M2_HOME to point at the unziped folder.
2) add %M2_HOME%/bin to your PATH environment variable
3) go to your home directory (probably C:/Users/????? and create a .m2 folder
4) move the settings.xml file from the maven unzippped/conf directory to the directory created in step 3.
5) you may have to set the proxy element correctly in your settings.xml file
It should work.
You might be new to maven, but it explicit the problem here:
Repository path /${basedir}/lib does not exist, and cannot be created.
This means that Maven could not locate the repository path you are trying to access. Or (from the "cannot be created") can't find the directory where to save the content.
As you did not provide pom.xml to look further, you'll have to find all ${basedir}/lib path in your pom.xml and in your maven settings (default to %USERPROFILE%/.m2/settings.xml or $HOME/.m2/settings.xml), then you may want to
try with an absolute path.
use an actual HTTP repository where that dependency and child' dependencies are.
use a repository server such as Sonatype Nexus or Archiva and provide a mirror/copy of it.
I have a maven module A that is dependent on the classes in the module B (both are child modules in a project).
In the A's pom.xml I have the following:
<dependencies>
<dependency>
<groupId>test.pack</groupId>
<artifactId>B</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
But when I try to build the A, the B does not appear in the dependencies correctly, I get compilation errors in the class that is in the A's test.pack.packFromA package in the import statement, which looks like import test.pack.packFromB.*.
So, my B dependency doesn't work correctly. But I thought classes from the B would be packed and added in the classpath, so I could use them. I tried to add <type> in that dependency, but that didn't help. What am I doing wrong here? Thanks in advance.
EDIT:
The <modules> part of parent's pom.xml looks like that:
<modules>
<module>B</module>
<module>A</module>
</modules>
Here is the error I get: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project A: Compilation failure: Compilation failure:
Have you done mvn install in module B, before you tried to build module A?
(If you do "mvn package" instead of mvn install, module B won't be placed in the repo, so Maven won't find it when building module A).
Also, have you tried building the multi-module project from the parent module? (When you do this, Maven will build the modules in the correct order)
If that's not it, verify that the classes you are referencing are located under src/main/java/test/pack/packFromB in module B. If they are under src/test/java.. you need a specific type of dependency for that.
Hope that helps.
I was doing a build yesterday for the second time of an open source project (Saiku) – I have made no changes to the POM.XML or any of the libraries/jars. The build succeeded a few days ago but now fails. The following pastebin shows the output. The errors are of two types – failure to delete /clean project, and cannot find artifact. Does anyone have any troubleshooting tips?
http://pastebin.com/g2bpAtMS
error type 1
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project saiku-core: Failed to clean project: Failed to delete /usr/local/.m2/repository/saiku/saiku-core/target/javadoc-bundle-options/javadoc-options-javadoc-resources.xml
error Type 2
- [ERROR] The build could not read 1 project -> [Help 1]
- [ERROR] The project org.saiku:saiku-webapp:2.2-SNAPSHOT (/usr/local/.m2/repository/saiku/saiku-webapp/pom.xml) has 1 error
- [ERROR] Non-resolvable parent POM: Could not find artifact org.saiku:saiku-core:pom:2.2-SNAPSHOT and 'parent.relativePath' points at wrong local POM # line 3, column 10 -> [Help 2]
Are you building within your local repo? That would be bad.
I get similar errors because, I think, my virus checker locks a file underneath the target/ directory and clean cannot delete the directory. I delete the directory manually and resume the build.
Failed to delete /usr/local/.m2/repository/saiku/saiku-core/target/javadoc-bundle-options/javadoc-options-javadoc-resources.xml
You have locked this file. Close every program which could have opened it.
Failed to delete /usr/local/.m2/repository/saiku/saiku-ui/target/classes/routers/QueryRouter.js
Idem for this file.
/usr/local/.m2/repository/saiku/saiku-server/target/saiku-server-foodmart-2.2-SNAPSHOT.tar.gz
Idem for this file.
Could not find artifact org.saiku:saiku-core:pom:2.2-SNAPSHOT and 'parent.relativePath' points at wrong local POM
It seems you have changed something : Maven does not find the parent pom referenced by relativePath attribute.
Check these errors, you always many errors.
I've fixed that by setting relativePath in pom.xml of saiku-webapp:
<parent>
<artifactId>saiku-core</artifactId>
<groupId>org.saiku</groupId>
<version>2.6-SNAPSHOT</version>
<relativePath>../saiku-core/pom.xml</relativePath>
</parent>