Reputation: 317
I am trying to upgrade a project from JDK 7
to JDK 8
.
In order to fix some issues during compile time, I needed to upgrade Maven to 3.6.3
as well.
The other issue is fixed with this upgrade however, I am getting the below error during mvn install
Failed to execute goal on project jbossha-PATCH: Could not resolve dependencies for project com.company.wae:jbossha-PATCH:jar:5.1.0.GA: Could not find artifact sun-jaxb:jaxb-api:jar:2.2 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
When I check my m2 repo, the jax-api.jar
is present under sun-jaxb
folder. If I delete sun-jaxb, it is created again with jax-api.jar.
This dependency is present in a lot pom.xml within the project.
Why the error is saying that it can not find the artifact and is there a way to solve this issue?
Upvotes: 0
Views: 1967
Reputation: 718816
Why the error is saying that it can not find the artifact and is there a way to solve this issue?
Because the dependency in the POM files is incorrect. I checked, and there are no official dependencies for "sun-jaxb" in Maven Central.
The correct Maven dependency for the JAXB apis in Java 8 is
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.8</version>
<scope>provided</scope>
</dependency>
as described in "https://stackoverflow.com/questions/63608553". I checked and the artifact is there, as are older and newer versions.
So a good solution would be to update all of the POM dependencies.
Now I presume that you are trying to build was building correctly before you started porting it. (Did you check?) If it was, then it must having been getting the "sun-jaxb:jaxb-api:jar:2.2" dependency from ... somewhere:
It would be a good idea to figure out how it worked before.
Upvotes: 1