Spring security 4.0.0 in maven? - java

There is the documentation about spring security 4.0.0 but in maven repository the latest version is 3.2.5. Where can I get the jar?

As it's said in the doc, you have to add a new repository in your pom.xml
http://docs.spring.io/spring-security/site/docs/4.0.0.RC1/reference/htmlsingle/#maven-repositories
And then you'll find the dependency in 4.0.0 version

Spring security 4.0.0.RELEASE has not been released yet.
Use the following snippet for 4.0.0.RC1:
<dependencies>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.0.0.RC1</version>
</dependency>
</dependencies><repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
See here: http://projects.spring.io/spring-security/

The release version of Spring are hosted on Maven Central. However, if you want to use milestone or snapshot versions , then a custom Spring repository needs to be added to the pom
In your case 4.0 is in snapshot version
So First Add A New Custom Repository
<repositories>
<repository>
<id>repository.springframework.maven.snapshot</id>
<name>Spring Framework Maven Snapshot Repository</name>
<url>http://repo.spring.io/snapshot/</url>
</repository>
</repositories>
Once You Define A Custom Repo Define Dependencies For Snapshot Build
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.0.3.BUILD-SNAPSHOT</version>
</dependency>

Related

How to configure Maven External Repositories to be Dependency Specific

In my Maven configuration I have 6 repositories. 3 Open Source for Geo Tools Java framework and 3 proprietary with encrypted credential access.
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>boundless</id>
<name>Boundless Maven Repository</name>
<url>http://repo.boundlessgeo.com/main</url>
</repository>
I added the external repositories mentioned here: http://docs.geotools.org/latest/userguide/tutorial/quickstart/eclipse.html
I added the plugin repositories as well and updated my settings.xml so the repositories in both matched.
<pluginRepository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/2</url>
</pluginRepository>
<pluginRepository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</pluginRepository>
<pluginRepository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>boundless</id>
<name>Boundless Maven Repository</name>
<url>http://repo.boundlessgeo.com/main</url>
</pluginRepository>
I even downloaded the jars I need for these Geo Tool dependencies and placed them in my .m2 folder.
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>18.2</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>18.2</version>
</dependency>
However, when I try and run a mvn clean install -X I can see that I am getting a 401 Unauthorized when Maven is trying to transfer org.geotools jars to/from the proprietary repositories I have configured, but I don't even want Maven to try.
How can I configure Maven so that for org.geotools.* load from these 3 repositories : <id>maven2-repository.dev.java.net</id>, <id>osgeo</id>, <id>boundless</id> and otherwise load from the proprietary repositories?
I heard that I can configure a proxy, but nobody is explaining how I would do that. I tried to store the jars I need for Geo Tools in my proprietary repository, but was told I can't. I also tried to configure a mirror to direct traffic to those external repositories only in my settings.xml like this below, but am seeing issues of cannot transfer jars from/to that only exist in the proprietary repository.
<mirrors>
<mirror>
<id>boundless</id>
<name>Boundless Repository Mirror</name>
<url>http://repo.boundlessgeo.com/main</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
I don't know if this can be done with maven but can be done with Artifactory virtual repositories. Other repository management tools should have similar concepts.
Basically you setup a Artifactory repository and your applications should refer to this repository. And you can configure inside Artifactory to which jars should be download from which repositories.
Consider that the Include Patterns and Exclude Patterns for a repository are as follows:
Include Patterns: org/apache/,com/acme/
Exclude Patterns: com/acme/exp-project/**
In this case, Artifactory will search the repository for org/apache/maven/parent/1/1.pom and com/acme/project-x/core/1.0/nit-1.0.jar but not for com/acme/exp-project/core/1.1/san-1.1.jar because com/acme/exp-project/** is specified as an Exclude pattern.
https://www.jfrog.com/confluence/display/RTF/Common+Settings#CommonSettings-Package
https://www.jfrog.com/confluence/display/RTF/Virtual+Repositories

Missing artifact org.springframework:spring-beans:jar:5.0.0.M4

I have a java spring mvc apication. and when i add the following dependency into the pom.xml:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.0.0.M4</version>
</dependency>
it complains with:
Missing artifact org.springframework:spring-beans:jar:5.0.0.M4
So, what is wrong in my pom?
It is a milestones (pre released) version, which is not available in Maven. If you want to use it you can add spring milestones repository to your pom.xml.
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
However, since it's a pre-released version, it is not advisable to use it in production environment, unless you have a specific requirement/ feature that is only available in new version, since it may contain bugs.
use bellow version of dependency from current version of Spring-Beans. you can use bellow dependency :-
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.8.RELEASE</version>
</dependency>
after adding this update maven project
By default pom.xml has repository mentioned as below.
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
As 5.0.0.M4 is milestone version like alpha or beta version, mentioned dependency/jar is not present in maven central repository so error is produced.Add below lines in pom.xml and dependency will get downloaded.
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>myrepo</id>
<url>https://artifacts.alfresco.com/nexus/content/repositories/public/</url>
</repository>
</repositories>

Jasper server maven repository url?

I am trying to get below dependency from jasper server.
<dependency>
<groupId>com.jaspersoft.jasperserver</groupId>
<artifactId>jasperserver-api</artifactId>
<version>6.0.1</version>
</dependency>
But i am getting below error
Missing artifact com.jaspersoft.jasperserver:jasperserver-api:jar:6.0.1
Here is my POM
<project ...>
<modelVersion>4.0.0</modelVersion>
....
<name>jasperProject</name>
<url>http://www.jaspersoft.com</url>
<dependencies>
<dependency>
<groupId>com.jaspersoft.jasperserver</groupId>
<artifactId>jasperserver-api</artifactId>
<version>6.0.1</version>
</dependency>
</dependencies>
</project>
With some simple googling you can get to this other answer on SO, where you can find a reference to this, which in term states you can add it like this:
<repository>
<id>JasperForge Maven Repository</id>
<!-- note: you need a <server> definition at bottom of file this file -->
<url>http://anonsvn:anonsvn#jasperforge.org/svn/repos/maven2</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
It also seems there's http://www.jasperforge.org/maven2/, which appears to be a non-browseable repository.
Another option is to put all required jars to a local maven repository. I know this is not the best solution, but it works, when you have no idea regarding correct Jasper public repository

Spring-data-elasticsearch maven dependency not found

I clone repository from https://github.com/spring-projects/spring-data-elasticsearch/blob/master/pom.xml
In pom.xml I have:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.M2</version>
</dependency>
but maven can not find this lib in repository.
I also try: https://github.com/spring-projects/spring-data-elasticsearch
but it is the same spring-data-elasticsearch version.
I'm assuming you're using Maven Central as your repository. I didn't see it there either.
According to the project site, spring-data-elasticsearch is available at http://repo.spring.io/libs-milestone. Did you try this repo?
Try to use the following repository.
<repositories>
<repository>
<id>spring-snapshot</id>
<name>Spring Maven SNAPSHOT Repository</name>
<url>http://repo.springsource.org/libs-snapshot</url>
</repository>
</repositories>
Dependency
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.M1</version>
</dependency>
I try once again after few hours and It works. Seriously I have no idea why. Correct configuration is:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.RC1</version>
</dependency>
<repository>
<id>spring-libs-milestone</id>
<name>Spring Milestone Repository</name>
<url>http://repo.spring.io/libs-milestone</url>
</repository>
I am not understanding where is the confusion here ?
Project is not yet fully released hence it's still using milestone repo of springsource instead of maven central repo. It will get released within 2 weeks with Spring Data release train Dijkstra.
Spring Data Elasticsearch GitHub page stats that
Maven configuration
Add the Maven dependency:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.RC1</version>
</dependency>
<repository>
<id>spring-libs-milestone</id>
<name>Spring Milestone Repository</name>
<url>http://repo.spring.io/libs-milestone</url>
</repository>
If you'd rather like the latest snapshots of the upcoming major version, use our Maven snapshot repository and declare the appropriate dependency version.
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
</dependency>
<repository>
<id>spring-libs-snapshot</id>
<name>Spring Snapshot Repository</name>
<url>http://repo.spring.io/libs-snapshot</url>
</repository>

Maven artifact jar different name than version

I got a small question about Maven. I got a project my pom.xml
It has basically this repositories:
<repositories>
<repository>
<id>alfresco-mirror</id>
<name>Alfresco Public Mirror</name>
<url>http://maven.alfresco.com/nexus/content/groups/public</url>
</repository>
<repository>
<id>alfresco-snapshots</id>
<name>Alfresco Public Snapshots</name>
<url>http://maven.alfresco.com/nexus/content/groups/public-snapshots</url>
<snapshots>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
<repository>
<id>alfresco</id>
<name>Alfresco Public </name>
<url>http://pipin.bluexml.com/nexus/content/repositories/thirdparty/</url>
<snapshots>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
and this dependency:
<dependencies>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-web-service-client</artifactId>
<version>3.4.d</version>
<type>jar</type>
</dependency>
</dependencies>
I think the main problem is that jar file and version got different names.
How can I solve this?
I thank your help in advance.
PS: Just for save time, this dependency link location
Try adding a classifier node to see if that works:
<dependencies>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-web-service-client</artifactId>
<version>3.4.d</version>
<classifier>community</classifier>
<type>jar</type>
</dependency>
</dependencies>
You can see the reasoning behind that here. Long story short, classifiers are just appended to that artifact name right after the version number. They're not used all that often, but you do see them from time to time.

Categories

Resources