Spring 2.2.1 Build Error Missing artifact com.microsoft.sqlserver:sqljdbc4:jar:4.0 - maven

For the part of spring 4.1.7 to spring boot 2.2.1,i have added spring-boot-starter-parent in my parent project as given below.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
<relativePath/>
</parent>
when I tried to build my parent and child project, it getting an error
Missing artifact com.microsoft.sqlserver:sqljdbc4:jar:4.0
.m2 folder structure
Am also refer the following link
stackoverflow
How to solve this issue.

I tied to delete C:/Users/Administrator/.m2/repository/com/microsoft/sqlserver/sqljdbc4/4.0 folder then rebuild the project .Now its working fine for me.

Related

Why spring.io generate pom without version?

I'm new to springboot and using spring.io to create project in order to create microservices.
When creating a project using spring.io website, a pom is created with all the relevant
dependencies but versions are not added.
Should I add the versions myself looking the maven repository jar (all jars include
versions on them)?
All dependencies (and configurations) are managed by Spring Boot. The parent of the project you generated with Spring Initializr has the parent set to spring-boot-starter-parent:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
The parent of spring-boot-starter-parent is spring-boot-dependencies which defines all dependency versions.
Therefore you don't need to specify any versions of the starter dependencies or their dependencies manually.
Please take a look at The Spring Boot Starter Parent on Baeldung for a quick overview.

Why does spring dependencies on Maven Central differ from actual local?

I am using spring-boot-starter-parent 2.3.9.RELEASE which according to Maven Central should give me spring-boot-starter-security 2.3.9.RELEASE which in turn should give me spring-security-config 5.3.8.RELEASE.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
However, when I look at Eclipse I see spring-security-config 5.3.5.RELEASE. I dont understand why my local is not reflecting spring-security-config 5.3.8.RELEASE for this artifact even though spring boot starter parent and spring boot starter security (both parents of this) are correctly showing 2.3.9.RELEASE. Also I'm not sure I understand what "Managed from 5.3.8.RELEASE" means in the screenshot. Could someone assist ?
This means that an entry in your <dependencyManagement> section of the POM overrode the version.
This may be a direct entry or a BOM, which you recognise by <scope>import</scope>.

Invalid spring-boot-dependency version when using jgitver and local repo in maven

When I use spring-boot-starter-parent combined with local repository and jgitver I get the following error:
[ERROR] The project tmplsvcpkg:TMPL_SVC_NAME-parent:0.0.0-27-a592e4fb-feature_gitlabci-dirty (/home/user/git/service-template/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for org.springframework.boot:spring-boot-starter-parent:[unknown-version]: Could not find artifact org.springframework.boot:spring-boot-dependencies:pom:0.0.0-27-a592e4fb-feature_gitlabci-dirty in internal-repository (https://mvnrepo) # org.springframework.boot:spring-boot-starter-parent:[unknown-version], /home/user/git/service-template/.m2/repository/org/springframework/boot/spring-boot-starter-parent/2.2.0.RELEASE/spring-boot-starter-parent-2.2.0.RELEASE.pom, line 3, column 11 -> [Help 2]
Note unknown-version for spring-boot-starter-parent and 0.0.0-27-a592e4fb-feature_gitlabci-dirty for spring-boot-dependencies. The 0.0.0-27-... version is the version calculated by the jgitver. It looks like the version resolution gets messed up somehow. If I change the local repository to any directory outside of my project it starts working again. If I supress jgitver it starts working again. If I define the local repo even deeper in my project (like maven.repo.local=x/y/z/.m2/repository, the error is still present.
I defined the parent in my pom.xml in this way:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
</parent>
And I run my maven in this way:
mvn compile -Dmaven.repo.local=.m2/repository -U
If I add jgitver.skip=true, everything works.
I suspect it might have something to do with the fact that spring-boot-starter parent defines it's parent (spring-boot-dependencies) as relative to it's position:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath>../../spring-boot-dependencies</relativePath>
</parent>
Has anyone any ideas why it might be happening and how to fix it?
It turns out it's a well known issue and is resolved by a certain configuration of the plugin (you have to exclude the .m2 directory in plugin config). More details are in this issue:
https://github.com/jgitver/jgitver-maven-plugin/issues/60

JHipster project with 4.13.3 and Maven integration QueryDSL for querying JPA

When generating a JHipster project with 4.13.3, and doing a Maven integration of QueryDSL (like described in http://www.querydsl.com/static/querydsl/4.1.3/reference/html_single/#d0e132), the Query types are not generated into target/generated-sources/java.
Before I used JHipster 4.10.x and it worked.
What changed? What I noticed with 4.13.3, that the pom.xml changed, for example the parent is not present any more, before it was:
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>1.5.7.RELEASE</version>
<relativePath/>
</parent>
Now with JHipster 4.13.3 this is missing. I also had to define in the properties of the pom.xml
<querydsl.version>4.1.3</querydsl.version>
otherwise when doing a mvn clean install it throws an ERROR.
What to do to do a Maven integration of QueryDSL into a JHipster project with 4.13.3?
Cheers

Gradle not handling Maven parent POMs with version-range

I have a Gradle build that needs to fetch dependencies from a Nexus repo that has been populated using Maven. Some of the POMs there use version-ranges when specifying a parent POM.
In my build.gradle I put a dependency:
compile group: 'com.company.platform', name: 'abc-common', version: '[11.0,12.0['
The Gradle logs show that a request is made for the versions of abc-common, and its POM and its parent's POM are fetched:
abc-common-11.0.7-17042111.pom:
<parent>
<groupId>com.company.platform</groupId>
<artifactId>abc-parent</artifactId>
<version>11.0.7-17042111</version>
<relativePath>..</relativePath>
</parent>
abc-parent-11.0.7-17042111.pom:
<parent>
<groupId>com.company.corporate</groupId>
<artifactId>corporate-parent</artifactId>
<version>[11.0.7,11.0.8)</version>
<relativePath/>
</parent>
But Gradle fails to fetch the corporate-parent POM. Instead of requesting what versions are present on the repo, it tries to fetch using the version-range literal:
Loading http://nexus.company.com:8081/.../corporate-parent/[11.0.7,11.0.8)/corporate-parent-[11.0.7,11.0.8).pom
Am I doing something wrong? Is this a known problem with Gradle? Is there a work-around?
Any help is much appreciated. This is a show-stopper for me. If I can't find a solution, it's back to Maven.

Resources