Failed to read artifact in my case - maven

I am using MacBook. I have installed Apache Maven 3.1.1 .
Under my maven local repository path, I see that there is already installed the artifact of my base project:
~/.m2/repository/com/my/base/project/MyBase/1.0/MyBase-1.0.jar
In another project(feature-project)'s pom.xml, I added my base project as a dependency:
<dependency>
<groupId>com.my.base.project</groupId>
<artifactId>MyBase</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
But when I run maven clean install under feature-project, I got error:
Failed to collect dependencies at com.my.base.project:MyBase:jar:1.0: Failed to read artifact descriptor for com.my.base.project:MyBase:jar:1.0:
WhY? What did I do wrong?

Related

Failed to add RXjava dependency from pom file in intellij

I tried to open a maven project with Intellij. The project was originally created on eclipse and worked fine.
However I receive an error
Dependency 'io.reactivex.rxjava2:rxjava:2.2.19' not found
(I get the same error if I try to start a new project in Intellij with the rxjava dependency)
Here is my dependencies section in the POM file:
<dependencies>
<dependency>
<groupId>io.reactivex.rxjava2</groupId>
<artifactId>rxjava</artifactId>
<version>2.2.19</version>
</dependency>
</dependencies>
What am I doing wrong?
running
mvn clean install
from command line, solved the issue

How to add aem Uber jar dependency in maven build

I have used the maven archetype10 as shown below and created the project structure and everything was fine.
mvn archetype:generate -DarchetypeGroupId=com.adobe.granite.archetypes -DarchetypeArtifactId=aem-project-archetype -DarchetypeVersion=10 -DarchetypeRepository=https://repo.adobe.com/nexus/content/groups/public/
Now i wanted to add the aem uber-jar dependency and added the below dependency tags in the project pom.xml and in core module pom.xml respectively and also my repository tags are same as https://repo.adobe.com/
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.2.0</version>
<scope>provided</scope>
</dependency>
after adding the above dependency tag when i compile it is giving me the below error.
[ERROR] Failed to execute goal on project aemexample.core: Could not
resolve dependencies for project
com.krishh.example:aemexample.core:bundle:0.1: Could not transfer
artifact com.adobe.aem:uber-jar:jar:6.2.0 from/to
adobe-public-releases
(http://repo.adobe.com/nexus/content/groups/public): hostname in
certificate didn't match: <repo.adobe.com> != <devedge.day.com> OR
<devedge.day.com> -> [Help 1]
Is there anything am missing to add extra dependencies to compile and run this successfully.
You seem to be missing a classifier in your dependency. Try adding the one for AEM APIs, as suggested in the documentation. This should help Maven locate the necessary JAR in the repository:
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.2.0</version>
<classifier>apis</classifier>
<scope>provided</scope>
</dependency>
If that doesn't help, you should also look at the certificate warning. Check out the answers to this question for more information on the subject.
TL;DR - possible causes could be:
an old Maven version using an HTTP library that is not compliant with the certificate being used by the repository - try upgrading Maven
erroneous certificate used by the server
potential network configuration issues between you and the repository
an actual attempt at getting you to download a malicious file by a party pretending to be the Nexus

POM dependency for AEM 6.2 implementation of Amazon S3 Bucket

I am trying to implement Amazon S3 in Adobe Experience Manager 6.2 and using maven 3.3.9.
When i add dependency:
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.aws-java-sdk</artifactId>
<version>1.11.18_1</version>
</dependency>
It is not building project and throwing maven-scr-plugin error:
SCR Descriptor parsing had failures.
[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.20.0:scr (generate-scr-scrdescriptor) on project aviva-investors-bundle: SCR Descriptor parsing had failures (see log) -> [Help 1]
If I try to add only JAR
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.2</version>
</dependency>
Build is successful. But I am not able to resolve my project bundle. Bundle is in Installed state. Imported Packages shows: Cannot resolve dependency:
com.amazonaws.services.s3,version=[1.11,2) -- Cannot be resolved
Not sure what to add in dependency to make my imports work.
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.ClientConfiguration;
etc.
Any help is much needed.
When you include a dependency in your maven build it is not push to the osgi container. It would be used only to compile your site bundle.
Heres two options what do can do.
1. Upload the s3 jar as an osgi bundle
2. Create another maven task to deploy third party dependencies to your osgi container. See http://www.cqblueprints.com/tipsandtricks/build-and-deploy-osgi/deploy-third-party-libs.html

How to release and reference Grails plugins using local Maven repository

Summary
I create two plugins A and B with Grails 2.3.4 where B is a plugin used by A plugin. I get error when I use A plugin in my application.
Details
When I run the following command, for plugin B, it successfully release the plugin to local maven repository. I can see it in the ~/.m2/... folder.
~plugin-b: grails maven-install
Then I add a reference to plugin B with plugin A, so I add the reference to BuildConfig in plugin A:
plugins {
compile "com.test.plugins:b:1.0.0-SNAPSHOT"
}
Now, I think, I should be able to run the next command and the plugin should be released to the local maven repository but I get the error instead:
~plugin-a: grails maven-install
| Plugin packaged grails-a-1.0.0-SNAPSHOT.zip
| Generating POM file.....
| Error Could not find artifact com.test.plugins:b:jar:1.0.0-SNAPSHOT (scope: compile) (Use --stacktrace to see the full trace)
| POM generated: //dependencies/dependencies_A_plugin/target/pom.xml...
Maven install complete.
Here is the generated POM file:
// pom header
<artifactId>a</artifactId>
<packaging>zip</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>A</name>
<description>Brief summary/description of the plugin.
</description>
<url>http://grails.org/plugin/a</url>
<developers>
<developer>
<name>Your name</name>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>com.test.plugins</groupId>
<artifactId>b</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
... just ending tags
Actually, also plugin A has been released to the local Maven repository, but it is probably corrupted, because when I create a Grails application and add a reference to A plugin into BuildConfig, then I am not even able to start up that application.
~ grails
| Error Resolve error obtaining dependencies: Could not find artifact com.test.plugins:b:jar:1.0.0-SNAPSHOT (Use --stacktrace to see the full trace)
| Error Could not find artifact com.test.plugins:b:jar:1.0.0-SNAPSHOT
So, the application has found A plugin, but not the B plugin, which is referenced by A plugin. To me, it seems there is an issue with generated POM file in the local Maven repository for the A plugin. There is probably missing:
<type>zip</type>
But I have not found a way how to add the type to that dependency.
Anyone able to help?

Maven - Unable to resolve dependencies

Im trying to compile a Maven project. The compile fails however due to a "Failure to find xx.xxx.jar" in the repository i have specified in my settings.xml. I have access to this repository and when i navigate to the Url of the repository maven is trying to use i can see a pom file with the name of the jar but no jar. When i open the pom it contains the correct groupid and artificatid and jar name however the jar is not in the same directory.
Maven gives another error saying that "resolution will not be reattempted until the update interval of my repo-server has elasped or updated are forced".
What is happening here?
When maven goes to the repo i specify in settings.xml and finds a pom for the jar does it then try and go out to some external site to resolve the dependency or should the jar exist in the same folder as the pom?
What module are you attempting to download?
I discovered something similar with the following Maven central module:
http://search.maven.org/#artifactdetails|net.sf.json-lib|json-lib|2.4|jar
The Maven POM packaging declaration was jar, but no jar in Maven called "json-lib-2.4.jar"
When I looked at the files actually stored, I discovered that the author is providing two versions of the jar, each compiled for different versions of the JVM:
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk13</classifier>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>

Resources