Resolving broken source in Maven central repository - java

I need two dependencies from the same organization, but it seems the link to their source is broken.
First: https://mvnrepository.com/artifact/org.moxieapps.gwt/uploader
Second: https://mvnrepository.com/artifact/org.moxieapps.gwt/highcharts
<dependency>
<groupId>org.moxieapps.gwt</groupId>
<artifactId>uploader</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.moxieapps.gwt</groupId>
<artifactId>highcharts</artifactId>
<version>1.7.0</version>
</dependency>
[ERROR] Failed to execute goal on project ctap-web: Could not resolve dependencies
for project com.test:test-web:war:1.0.0-SNAPSHOT: The following artifacts could
not be resolved: org.moxieapps.gwt:uploader:jar:1.1.0,
org.moxieapps.gwt:highcharts:jar:1.7.0: Could not find artifact
org.moxieapps.gwt:uploader:jar:1.1.0 in central
(https://repo.maven.apache.org/maven2) -> [Help 1]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read
the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
I've downloaded the source from Sourceforge and placed it in .m2/repository/org/moxieapps/gwt/ but Maven still tries to download it from the central repo.

The jar org.moxieapps.gwt:uploader:jar:1.1.0 is not in MavenCentral, which you can see here:
https://search.maven.org/search?q=g:org.moxieapps.gwt%20AND%20a:uploader
Note that mvnrepository (the links you provided) have nothing to do with MavenCentral.

Related

PluginResolutionException: Plugin .url=jdbc:postgresql://localhost or one of its dependencies could not be resolved: Could not find artifact

I am trying to run mvnw clean compile on a rather old project.
The whole line is
../mvnw clean compile -Dflyway.url=jdbc:postgresql://localhost:5431/my_database -Dflyway.user=some_user -Dlyway.password=xxx -Dflyway.outOfOrder=true flyway:migrate -f pom.xml -U -X
This gives me the following error
BUILD FAILURE
[ERROR] Plugin .url=jdbc:postgresql://localhost or one of its dependencies could not be resolved: Could not find artifact .url=jdbc:postgresql:jar://localhost in central (https://repo.maven.apache.org/maven2) -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin .url=jdbc:postgresql://localhost or one of its dependencies could not be resolved: Could not find artifact .url=jdbc:postgresql:jar://localhost in central (https://repo.maven.apache.org/maven2)
And then further down
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact .url=jdbc:postgresql:jar://localhost in central (https://repo.maven.apache.org/maven2)
This is the part of the pom.xml where I add the dependency (which is what I can find on Maven https://mvnrepository.com/artifact/org.postgresql/postgresql/42.2.19)
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.19</version>
</dependency>
And for what its worth, this is defined in the Wildfly properties for the database (database.properties)
database.test.url=jdbc:postgresql://localhost:5431/my_database_test
database.test.username=some_user
database.test.password=xxx
database.url=jdbc:postgresql://localhost:5431/my_database
database.username=some_user
database.password=xxx

Unable to download open saml jar while building the project

While building my project I am getting unknown host exception while downloading the org.opensaml:opensaml:jar:2.6.6 jar.
I am using below dependencies in my project. And error I was receiving is as below.
<dependency>
<groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml2-core</artifactId>
<version>1.0.10.RELEASE</version>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml</artifactId>
<version>2.6.1</version>
</dependency>
Error:
Could not resolve dependencies for project security:jar:1.0.0: Failed to collect dependencies at org.springframework.security.extensions:spring-security-saml2-core:jar:1.0.10.RELEASE -> org.opensaml:opensaml:jar:2.6.6: Failed to read artifact descriptor for org.opensaml:opensaml:jar:2.6.6: Could not transfer artifact org.opensaml:opensaml:pom:2.6.6 from/to central (https://repo.maven.apache.org/maven2/): transfer failed for https://repo.maven.apache.org/maven2/org/opensaml/opensaml/2.6.6/opensaml-2.6.6.pom: Unknown host No such host is known (repo.maven.apache.org) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Jenkins fails to compile Maven for my Selenium Project

I am trying to schedule my project on Maven. It uses Apache POI. Project works fine on my Laptop but it fails to compile Maven on Jenkins that is on a remote machine in our office. The error I face is:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile** (default-testCompile) on project GunAV-test-automation: Compilation failure: Compilation failure:
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/Mytest/-42/src/test/java/utilities/ReadExcel.java:[11,37] **package org.apache.poi.xssf.usermodel does not exist**
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/Mytest/-42/src/test/java/utilities/ReadExcel.java:[12,37] package org.apache.poi.xssf.usermodel does not exist**
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
How could I fix this issue?
To fix a compilation error
package org.apache.poi.xssf.usermodel does not exist
you should add a poi-ooxml maven dependency:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
This dependency contains org.apache.poi.xssf.usermodel package.

Can't provide version ranges in the maven dependency management import scope

I have a large java project managed using maven.
We are using Maven 3 for management (specifically 3.6.0).
In the project, there is a sub=project with a runtime-v5.pom.xml.
In said pom, there is a version property
<properties>
<platform-v5.version>73.2.05</platform-v5.version>
</properties>
Which is used later in the file
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.company.thing.platform</groupId>
<artifactId>platform-parent</artifactId>
<version>${platform-v5.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.company.release</groupId>
<artifactId>platform-v5</artifactId>
<version>${platform-v5.version}</version>
<type>resolved-pom</type>
</dependency>
</dependencies>
</dependencyManagement>
My goal is to get maven to pull in the most recent version of platform and I don't want to update the version in this file every time. I thought that changing the specific version to a range would allow the project to always pull in the most recent version in accordance with the given range.
When the platform-v5.version is set to a specific existing version, it builds just fine, but when setting the version to a range such as [73.2.05,), I get errors such as
[INFO] Scanning for projects...
[INFO] Downloading from all_global_universal: https://nexus.company/platform-parent/%5B73.2.05,).pom
[ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Could not find artifact com.company.thing.platform:platform-parent:pom:[73.2.05,) in all_global_universal (https://nexus.company/content/groups/all_global_universal) # com.company:runtime-v5:[unknown-version], path/to/runtime-v5.pom.xml, line XX, column YY
#
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.company:runtime-v5:1.0.2 (path/to/runtime-v5.pom.xml) has 1 error
[ERROR] Non-resolvable import POM: Could not find artifact com.company.thing.platform:platform-parent:pom:[73.2.05,) in all_global_universal (https://nexus.company/content/groups/all_global_universal) # com.company:runtime-v5:[unknown-version], path/to/runtime-v5.pom.xml, line XX, column YY -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
Essentially, I want to know: Why can't you provide version ranges in the maven dependency management import scope?
While version ranges are not exactly deprecated, they are no longer considered a best practise. The modern way would be to run an appropriate update goal before the build so that the version numbers in the pom are the newest ones available.
This is a duplicate of Using maven dependency management import scope with version ranges
This Maven issue was resolved and will be released in Maven 4.0.0: https://issues.apache.org/jira/browse/MNG-4463

How to use GitHub Repo using JitPack.io in Maven

I wants to use https://github.com/liquibase/liquibase version 3.5.0-SNAPSHOT
I have added the following in pom.xml
<dependency>
<groupId>liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.5.0-SNAPSHOT</version>
</dependency>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
but got following error when compile:
[ERROR] Failed to execute goal on project XYZ: Could not resolve dependencies for project com.XYZ:jar:0.0.1-SNAPSHOT: Failure to find org.liquibase:liquibase-core:jar:3.5.0-SNAPSHOT in https://github.com/liquibase/liquibase was cached in the local repository, resolution will not be reattempted until the update interval of liquibase-repository has elapsed or updates are forced -> [Help 1]
There seems to be an issue with JitPack and downloading this repository. According to the maven modular example that JitPack provides, the dependency should be defined as follows:
<dependency>
<groupId>com.github.User.Repo</groupId>
<artifactId>Module</artifactId>
<version>Commit/Tag</version>
</dependency>
The following should then work:
<dependency>
<groupId>com.github.liquibase.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>f7f3b8f60b</version>
</dependency>
But it also fails resolving the dependency:
[ERROR] Failed to execute goal on project my-app: Could not resolve dependencies for project com.mycompany.app:my-app:jar:1.0-SNAPSHOT: Failure to find com.github.liquibase.liquibase:liquibase-core:jar:0885bc4 in https://jitpack.io was cached in the local repository, resolution will not be reattempted until the update interval of jitpack.io has elapsed or updates are forced -> [Help 1]
You can see that this is definitely an issue by just trying to use the liquibase parent repository (not just the liquibase-core module) as follows:
<dependency>
<groupId>com.github.liquibase</groupId>
<artifactId>liquibase</artifactId>
<version>f7f3b8f60b</version>
</dependency>
Which also errors out. According to JitPack's log for this commit, it looks like there is a compilation error with the source:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project liquibase-core: Compilation failure
[ERROR] /home/jitpack/build/liquibase-core/src/main/java/liquibase/parser/core/formattedsql/FormattedSqlChangeLogParser.
java:[213,209] ')' expected
It seems like the best route would be to file an issue with the JitPack folks and see if they can shed some light on it.

Categories

Resources