AEM Mocks missing artifact for latest version - maven

I have added the latest version of AEM Mocks (2.7.2) as a Maven dependency in my AEM project. When I try to build my project, I get an error saying that this artifact cannot be found: com.day.commons:day-commons-gfx:jar:2.1.28. So I looked online, found it and added it as a dependency. But now I get the same error when trying to build. Does this artifact still exist? When trying various recent versions of AEM Mocks, I found that they all depend on this missing artifact.
For now, I downgraded to version 2.3.0, which works fine without that artifact but I would like to use the most recent version if possible.
Can anyone please help? Thanks!

This artifact is defined as a workaround, it is explained here in comment:
https://github.com/wcm-io/wcm-io-testing/blob/develop/aem-mock/core/pom.xml#L254:
Workaround for AEM 6.5: The new uber-jar does no longer contain the package com.day.imageio.plugins
It works without any issues for me, so I would check if you have correctly configured Maven repositories. To do it, in your Maven project root type:
mvn help:evaluate
and then:
${project.repositories}
It should list your project effective repositories. Ensure that there is Central Repository (https://repo.maven.apache.org/maven2/) listed. If it is there, then maybe your corporate network cuts requests to external repositories or it was temporarily down.

Related

Could not able resolve javax.inject: javax.inject:1.0 - Gradle

I am getting below error while running Gradle build in Unix terminal.
Could not resolve all files for configuration ':imcalmsvc-service:compileClasspath'.
Could not find javax.inject:javax.inject:1.0.
Searched in the following locations:
- https://jcenter.bintray.com/javax/inject/javax.inject/1.0/javax.inject-1.0.pom
- https://repo.maven.apache.org/maven2/javax/inject/javax.inject/1.0/javax.inject-1.0.pom
However, there is no error while doing Eclipse-> Gradle refresh.
The error means the dependency wasn't found in either JCenter or Maven Central. When you are usure about the exact name of dependency or which repositories it is uploaded to, I recommend a search engine like mvnrepository.com. It aggregates metadata from a lot of different Maven repositories and even shows you how to use them in Gradle.
In your case, you can find the javax.inject library here. Notice that the only published version is simply 1 and not 1.0. Change this and it should work.

Missing artifact in pom.xml

I'm facing a problem in the pom.xml. It is showing the below error. I'm trying to update maven by adding the required dependencies but unable to solve the issue .
Resource Path Location Type Missing artifact org.springframework.security:spring-security-web:jar:4.2.2.BUILD-SNAPSHOT pom.xml /spring-security-samples-xml-insecure line 171 Maven Dependency Problem
SNAPSHOT dependencies are not retrieved by default. If you really need that specific version you will need to add the spring snapshot repository to maven. Usually one relies on released versions only: maven central
The version you are looking for is in the spring snapshots repository.
The maven manual describes how to work with multiple repositories. Usually people use a repository proxy like Nexus or Artifactory to simplify this.

can't find my maven artifacts

I'm working in eclipse and I have a problem that I can't import my personal java libraries.
I created the libraries and 'installed' them into my local maven repo (using mvn install). This created a subdirectory related to the 'version' name that was in the POM file from when I ran the command. Which seemed fine.
So in this directory there where the usual jar files and other stuff.
When I released this file I manually changed the name of the version in the POM. going from 0.0.1-SNAPSHOT to 0.0.1-RELEASE
This seems to have worked as I would have expected.
However I can't seem to find import the new release jar.
Using the maven repositories browser in eclipse I can see that the new artifact is in the 'local' repository.
I try to add the dependency in the following methods:
Select the main project -> Maven -> add dependency.
This adds the dependency details into the pom but with a type value detail of <type>pom.lastUpdated</type>
Select the project pom.xml file -> Maven -> add dependency.
This time the artifact for the 0.0.1-RELEASE is greyed out I can select it, but I guess nothing is actually happening.
The original 0.0.1-SNAPSHOT it selectable, and if I use this I do not have a <type> detail in the pom.
I don't understand why there is a difference in the RELEASE and SNAPSHOT artifacts, as they have both been generated in the same way, and clearly they are both visible in the browser, the contents of the directory on disk are the same. The file names and contents are identical with the exception of the word RELEASE or SNAPSHOT.
I know that I can simply add in the RELEASE jar to my build path, but this seems to be a ridiculous thing to have to do if I intend to use maven (or do I need to do this).
I don't want to use an external repo for storing my artifacts, and I'm not too keen to go to the trouble of installing nexus (or similar) on my local machine (just because I've had trouble with it in the past).
What am I missing so as I can get my maven project to see my local repository and all its artifacts.
Thanks in advance.
David
ps I've already tried things such as mvn dependency:purge-local-repository which definitely pulled in / updated all the local jar dependencies.
So I've managed to work around my problem.
As such this solution is ridiculous, and breaks all the purpose of maven.
So I found (from running maven from the cli) that there was an error in the parent of the project I was attempting to use.
The parent was missing a direct link to the scm plugin (version error).
Once I solved this problem, I then returned to the sub project, and got a lot of errors from missing stuff from the parent.
Essentially it was not 'seeing' all the log4j dependencies.
The solution (well non-solution really).
Add all the log4j dependencies to the sub project.
Edit in SCM and surefire test plugins (as it also started to fail the test code due to missing junit).
So this is great.
I have to define all my dependencies on log4j and in my sub / child project's pom.xml file.
I also need to define them all in my parent's pom.
As it then still refused to run tests in my new project (that used the above as a dependency), and refused to find log4j also. I then decided to add all of these as dependencies for my current project.
Great.
I thought the whole point of maven was I could define my dependency on log4j in my my logging library that I use (which is the dependency), and then it would 'automagically' pull in all the required from this dependency.
Clearly not.
As stated at the start. This is NOT AN ANSWER it is a crazy work around.
My logging library that I use should be able to define its own requirement on a specific log4j version (such as moving from log4j to log4j2), and then when I include this as a maven dependency any change to the required dependency should be seen automatically.
But No : I have to import the dependency on log4j in my other projects also. So now if I had updated my logging library from log4j to log4j2 I would need to go to all my project that use this library and update their pom's to ensure that I have the correct version of log4j.
Seems the whole point of maven has just been lost!
Can someone please tell me where I am going wrong!
David.

Trouble with maven in Netbeans

I want to create maven project in Netbeans. So, I do File->New project->Maven->Java Application. After that I try to build the project and get error:
The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10 is missing, no dependency information available.
But I can build this project from command line with mvn compile. Could uou tell me what is the problem with Netbeans?
NetBeans is using 3.0.4 maven by default. Unless you change that in Tools/Options menu. Are you building with 3.0.4 as well or are you using some earlier versions (2.x)?
That would explain the behaviour because 3.0.4 will not blindly rely on what artifact is in local repository but some additional metadata is also consulted to make sure your project build with the given set of defined repositories.
A common example when the problem occurs to me.
I use central directly everything downloads. when I later add a mirror, all artifacts are checked again through the mirror to make sure they are accessible. if teh Mirror doesn't actually mirror central, I get an error that way.
Another common example is: when building with 2.x, the additional metadata is not written, when later building with 3.0.4, all remote context is checked no matter what is present in local repo and the additional metadata files are constructed.

What's the Maven GAV coordinate for version 4.7 of jbossesb-soap.jar?

It's not in jbossesb-rosetta which I already depend on. I've looked at http://mavenhub.com/c/org/jboss/soa/esb but I can't seem to find it. I suppose I can always include it as a system dependency but only as a last resort.
Analysis
1)
That artifact is not present in Maven Central, explaining why Maven cannot find it by default:
http://search.maven.org/#search|ga|1|a%3A%22jbossesb-soap%22
2)
Jboss artifacts are hosted by a separate Nexus repository. A search there was similarily fruitless:
https://repository.jboss.org/nexus/index.html#nexus-search;gav~~jbossesb-soap~~~
3) A Google search threw up this same unanswered question on Jboss community forum:
https://community.jboss.org/thread/154253
Recommendation
Seems you are left with only one option. Upload the required jar into your own Maven respository so that the dependency can be found.
If you want to simply hack the jar into your current build, then I would recommend installing it into your local repository. Do not use system scope dependencies.
Jars can be installed locally using the Maven install plugin

Resources