Missing artifact in pom.xml - maven

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.

Related

AEM Mocks missing artifact for latest version

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.

How to include csjdbc.jar as part of maven dependency?

I have been looking for a dependency for csjdbc.jar in Maven repository so that I can build my app using maven and retrieve that jar on the fly. However, I cannot find a dependency in Maven repository related to that jar. Can anyone help, please?
Hopefully you have already resolved this issue.
csjdbc.jar is not listed in maven repositories. If you have composite software installed you can copy the jar from
~\Composite Software\CIS 6.1.0\apps\jdbc\lib
directory to your local machine's maven repository like below with proper versioning:
C:\maven\repository\composite\csjdbc\6.1\csjdbc-6.1.jar
(I have 6.1 jar)

Is there a way to say maven not to use timestamp for dependency resolution

I am using MAVEN3 and I have a project XXX with version 1.0.0-SNAPSHOT and it is being uploaded to artifactory.I can find the jar uploaded to artifactory as XXX-1.0.0-SNAPSHOT.jar.
Another project YYY uses XXX-1.0.0-SNAPSHOT.jar as its dependency and it is declared as
<dependency>
<groupId>...<...>
<arti...>XXX</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
When I try to build YYY maven is trying to download XXX jar file from artifactory and it fails to find.
I get the following error
Could not resolve dependencies for project com......YYY:jar:1.0.0-SNAPSHOT: Could not find artifact com....XXX:jar:1.0.0-20130710.163046-1 in repo1 (https://artifactory.xxx.com/artifactory/REPO1)
I can see that it tries to download a jar with specific timestamp.How can I tell maven not to use timestamp to download my dependency.
Any help on this is appreciated.
Support for non-unique snapshots was removed in Maven 3 (see related JIRA issue).
I found an Artifactory document mentioning one way to handle this, near the bottom of the page.
My team has noticed problems if developers publishing snapshots to the same group/artifact in the snapshot repository are not all using the same Maven version. Either everyone needs to stick with Maven 2, or everyone uses Maven 3. Mixing doesn't work well.

maven repositories

I'm new to maven. I'm still failing to grasp the concept of it.
For example I'm looking for com.extjs:gxt:jar:2.2.5 or org.syslog4j:syslog4j:jar:0.9.46. I can't find them in any repo. Yet they seem fairly common packages.
Does that mean I have to download them by hand ? Doesn't it defeat the whole idea of maven ?
Where can I find a good repository that will have all these artifacts so that I don't need to download the jars by hand ?
What am I doing wrong when using maven, this definitely does not seem the way to go...
You're not doing anything wrong. The issue is that those artifacts don't exist in maven central repository. By default, that's the only repository maven will download from. You can add additional repositories (see maven docs) to configure repositories that aren't mirrored to central automatically.
As #Michael said, you are not doing anything wrong.
The default Maven central repository is not going to provide every possible artifact on the earth.
Normally you can have two way to solve it:
1) The artifact you use may be provided by some organization, which they provide their own repository to host those artifact. Tell Maven to lookup those repositories so that Maven can retrieve the corresponding artifact.
or
2) Get the JAR etc and put in your local environment.
There are two most commonly used ways for the above work:
A) Have a "local" maven repository/proxy (e.g. Nexus, Artifactory), and make your Maven points to this repository. Adding new remote repository (1) is mostly done by adding extra repo to proxy under your local Maven repo. Manually handling 3rd party artifact (2) is done by deploying the JAR to your local repo.
B) All done locally by your local Maven. Adding new remote repo (1) is done by updating the settings.xml (or your project POM.xml). Manually handling 3rd party artifact (2) is done by installing 3rd party JAR to local repository.
you can use
<dependency>
<groupId>com.extjs</groupId>
<artifactId>gxt</artifactId>
<version>2.3.0-gwt22</version>
</dependency>

Grails refresh-dependencies doesn't download snapshot dependency from local maven repository

I am using Grails 2.1.1 and Maven 3.0.3.
In my buildConfig.groovy, I have pom true and I generated the pom.xml via grails create-pom. In this pom I have a dependency with <version>1.0-SNAPSHOT</version> which exists only in my local maven repository. I can successfully run mvn clean compile on this pom.
However running grails refresh-dependencies does not download the most recent version of my snapshot dependency from my local maven repository. The only way I can get it to download the latest version is to manually delete it from the ivy cache.
According to the documentation:
All dependencies (jars and plugins) with a version number ending in -SNAPSHOT are implicitly considered to be changing by Grails.
I assume it would recognize my snapshot file as changing and download it when it is modified. Am I missing some other configuration step? I only want to use maven for dependency management, but is this entirely the wrong way to use Maven with Grails?
This is actually the normal behavior of the Aether resolver.
--refresh-dependencies doesn't bypass your local maven cache. To do that, you'll need to set the maven repository that contains your dependency to always download new snapshots. In BuildConfig.groovy's repositories block:
mavenRepo ("http://my.server/repos/my-grails-plugins") {
updatePolicy 'always'
}
Credit to http://asoftwareguy.com/2013/10/25/grails-2-3-maven-dependency-caching-issues/.
Since I haven't got any responses, what seems like the solution to this is to just not use the grails command line, but rather use the maven goals for Grails.
mvn grails:run-app does the trick. All snapshot dependencies are refreshed and I can start up my app and see the local changes reflected. This way I'm ignoring ivy altogether and letting maven take care of everything.
Edit: If you go this route, I suggest following chapter 5 of the User Guide on Maven Integration for setting up your pom.xml, etc. I was able to follow this and get it set up without any surprises.

Resources