why the project pom.xml is showing this Non-Resolvable error - spring

Dont know whats wrong here. I cloned the project form the bitbucket repo. Upon importing the project as a existing maven project this is occuring

I think the problem is that you are using the snapshot version of the spring boot and these dependencies are not available on the maven central so have to add the additional repository address.
Add the following snippets in the <project> component in your pom.xml
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

Related

Understanding Maven tags

I was using maven in my project, most of the cases I used only dependency tags, but this time I have below tags in use:
<repositories>
<repository>
<id>myrepo</id>
<name>REPO</name>
<url>http://host:8081/nexus/content/repositories/repo/</url>
<layout>default</layout>
</repository>
<repository>
<id>thirdparty</id>
<name>THIRD</name>
<url>http://host:8081/nexus/content/repositories/thirdparty/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>repo-snapshots</id>
<name>REPO-SNAPSHOTS</name>
<url>http://host:8081/nexus/content/repositories/snapshots/</url>
<layout>default</layout>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>repo1-snapshots</id>
<name>REPO1-SNAPSHOTS</name>
<url>http://host1:8081/nexus/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>myplugin</id>
<name>MY-PLUGIN</name>
<url>http://host:8081/nexus/content/repositories/central/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>distr</id>
<name>DISTR</name>
<url>http://host:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>distr</id>
<name>DISTR</name>
<url>http://host:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
I know that repositories is used to configure our remote repositories.
1) But what is the use of releases --> enabled = true indicates
2) also what it indicates when we say snapshots --> enabled=true instead of using releases.
3) Also what it indicates if we say updatePolicy=always and what happens if we do not mention this.
4) What is the use of pluginRepositories here? also the inner releases tag
5) What is the use of distributionManagement and its inner tags repository and snapshotRepository?
1) This means that Maven searches release versions (aka non-SNAPSHOT versions) in this repository.
2) Maven searches SNAPSHOT versions in this repository.
The distinction between (1) and (2) exists because if you do not have repository groups, you usually have different repositories for the different types.
3) This means that SNAPSHOTS are always (read: every build) updated from remote repositories. The standard policy is to cache downloaded SNAPSHOTs for one day (so triggering another build on the same day would not again download the newest SNAPSHOT).
4) These repositories are purely used for the dependencies of your plugins.
5) These are used to deploy artifacts you build yourself.

Where to get gwt-maven-plugin 2.8.0-SNAPSHOT

The gwt-maven-plugin documentation lists 2.8.0-SNAPSHOT as current version, and I'd like to evaluate the upcoming 2.8.0 GWT.
While version 2.7.0 is available directly from the Maven Central repository, I am unable to find the correct repository from which to retrieve the snapshot. Unfortunately I have been unable to find this information on the project's homepage.
Can anybody please provide me with a working <repository/> and <pluginRepository/> configuration to use in my pom.xml?
This worked for me:
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/google-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>snapshots-repo</id>
<!--<url>https://oss.sonatype.org/content/repositories/google-snapshots</url>-->
<url>https://oss.sonatype.org/content/repositories/public/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

Maven commands failing

I am trying to build a project using maven. I have a properties tag which has the following links in pom.xml-
<properties>
<release_deploy_repo>http://.../releases</release_deploy_repo>
<plugin_repo>http://.../public</plugin_repo>
<central_repo>http://.../public</central_repo>
</properties>
and then under repositories, i have
<repositories>
<repository>
<id>central</id>
<name>Central Repo</name>
<url>${central_repo}</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
when i try mvn clean install, i get this error -
${central_repo} not found. Any idea what i doing wrong?

Difference between repository and pluginrepository

My Android Maven project pom.xml contains the following entries. Now everything works fine. What is the difference between <repositories> entries and the <pluginRepositories> entries.
<repositories>
<repository>
<id>my-repo</id>
<url>http://10.10.10.230:8081/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>my-repo</id>
<name>my-repo</name>
<url>http://10.10.10.230:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
As #otakun85 stated, There is no technical difference at all. It's for having different configurations->behavior for plugins in contrary to normal artifacts. See repository vs. pluginRepository for more details.
Also check maven-users mailing list archives, It provides quite good explanation to it.
Maven will resolve plugin dependencies using the configured pluginRepository. Other artifact dependencies (eg. a parent pom) are resolved using repository.
Note: Things available on maven central will be resolved by default so you wouldn't normally need to include repository for those.
For example, if your pom.xml specifies a parent pom and a plugin dependency that both exist in the same repository you must still specify both repository AND pluginRepository. If you only configure one then maven will complain with "Unresolvable X" errors.

artifactory local repo in maven project

I've setted artifactory in localhost (I'm trying on localhost before setting up my server), but when I use this repo in my maven project I can't retrieve my libs. Any suggestions?
Artifactory provides you with a small utility that generates a Maven settings file based on the repositories configured in Artifactory and your selections; assuming your repositories are properly configured, this utility normally does a good job.
Try (change id ClaudioStas to central):
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://localhost:8081/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://localhost:8081/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://localhost:8081/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://localhost:8081/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>

Resources