Maven: missing artifact presto - java

I want add a new dependency into pom.xml. The eclipse shows the error: "Missing artifact presto:presto-jdbc:jar: 0.93"
I have tried to force update of snapshot. No fix.
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.29</version>
</dependency>
<dependency>
<groupId>presto</groupId>
<artifactId>presto-jdbc</artifactId>
<version>0.93</version>
</dependency>
</dependencies>
Are groupId, artifactId named arbitrarily? How can I fix this problem?(
No update dependency in Maven in my eclipse.)

Looking at maven central your dependency should be
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-jdbc</artifactId>
<version>0.93</version>
</dependency>
http://search.maven.org/#artifactdetails%7Ccom.facebook.presto%7Cpresto-jdbc%7C0.93%7Cjar

Related

Maven build failed due to JDT dependencies - No versions available for org.osgi.service:org.osgi.service.prefs:jar:[1.1.0,1.2.0)

Today when I tried to install my maven project, I get an error due JDT dependencies and here is the report information:
Cannot resolve No versions available for org.osgi.service:org.osgi.service.prefs:jar:[1.1.0,1.2.0) within specified range.
[ERROR] Failed to execute goal on project redundantcheck:
Could not resolve dependencies for project edu.fudan.selab:redundantcheck:jar:1.0-SNAPSHOT:
Failed to collect dependencies at org.eclipse.jdt:org.eclipse.jdt.core:jar:3.20.0 ->
org.eclipse.platform:org.eclipse.core.resources:jar:3.12.0 ->
org.eclipse.platform:org.eclipse.core.expressions:jar:3.5.100 ->
org.eclipse.platform:org.eclipse.core.runtime:jar:3.12.0 ->
org.eclipse.platform:org.eclipse.equinox.preferences:jar:3.10.0 ->
org.osgi.service:org.osgi.service.prefs:jar:[1.1.0,1.2.0): No versions available for
org.osgi.service:org.osgi.service.prefs:jar:[1.1.0,1.2.0) within specified range -> [Help 1]
I tried to add 1.1.0 org.osgi.service:org.osgi.service.prefs to the project, but still can't solve this problem. To avoid dependency update, I specied almost every version of the dependencies, but still encounter this error today. Here is my pom.xml:
<dependencies>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.20.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.core.commands</artifactId>
<version>3.9.800</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.platform/org.eclipse.core.contenttype -->
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.core.contenttype</artifactId>
<version>3.7.900</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.platform/org.eclipse.core.filesystem -->
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.core.filesystem</artifactId>
<version>1.7.700</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.platform/org.eclipse.core.jobs -->
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.core.jobs</artifactId>
<version>3.10.1100</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.platform/org.eclipse.core.resources -->
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.core.resources</artifactId>
<version>3.14.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.platform/org.eclipse.core.runtime -->
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.core.runtime</artifactId>
<version>3.20.100</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.platform/org.eclipse.equinox.common -->
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
<version>3.14.100</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.platform/org.eclipse.osgi -->
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.16.200</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.platform/org.eclipse.text -->
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.text</artifactId>
<version>3.11.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.75</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.core.expressions</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.app</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.preferences</artifactId>
<version>3.9.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.registry</artifactId>
<version>3.11.0</version>
</dependency>
</dependencies>
Is there anyway to solve this problem?
EDIT: The issue is known by the project team and tracked as eclipse-equinox/equinox.bundles#54 on GitHub.
The dependency:
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.preferences</artifactId>
<version>3.10.0</version>
Which is one of your transitive dependency, references this dependency in its dependencies list:
<dependency>
<groupId>org.osgi.service</groupId>
<artifactId>org.osgi.service.prefs</artifactId>
<version>[1.1.0,1.2.0)</version>
</dependency>
Source: org.eclipse.equinox.preferences-3.10.0.pom on maven central.
It is a mistake. As Maven tells you, this does not exist:
Cannot resolve No versions available for org.osgi.service:org.osgi.service.prefs:jar:[1.1.0,1.2.0) within specified range.
It should have been:
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.prefs</artifactId>
<version>[1.1.0,1.2.0)</version>
</dependency>
Which exists (note the different groupId).
Because you are not fixing the dependencies you are consuming in your project, and because the dependencies are using version ranges, suddenly you got a new version.
By the way as beingnurd has noted, there is now the newer version 3.10.1 of org.eclipse.equinox.preferences where this wrong dependency is fixed (see org.eclipse.equinox.preferences-3.10.1.pom).
If you continue to use always the newest dependency of the compatible range, the problem will be solved for you.
Now if we take a step back:
You are trying to use following JDT version:
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.20.0</version>
</dependency>
This corresponds to the Eclipse Version 2019-12 (also called 4.14 internally).
Your problem is that the eclipse projects (org.eclipse.jdt.core and all the dependencies) are using version ranges.
If you look at the org.eclipse.jdt.core dependencies declarations:
org.eclipse.platform:org.eclipse.core.resources:[3.12.0,4.0.0)
org.eclipse.platform:org.eclipse.core.runtime:[3.13.0,4.0.0)
org.eclipse.platform:org.eclipse.core.filesystem:[1.7.0,2.0.0)
org.eclipse.platform:org.eclipse.text:[3.6.0,4.0.0)
If you don't do anything, Maven always takes the latest:
Today (June 2022) this would be:
org.eclipse.core.resources: 3.16.100
org.eclipse.core.runtime: 3.24.100
org.eclipse.core.filesystem: 1.9.300
org.eclipse.text: 3.12.0
When the library was published (December 2019) this was:
org.eclipse.core.resources: 3.13.600
org.eclipse.core.runtime: 3.17.0
org.eclipse.core.filesystem: 1.7.600
org.eclipse.text: 3.10.0
And of course this is recursive, you need to do this for all the dependencies.
Letting Maven choose always the latest is problematic:
It prevents you creating reproducible build, because the dependencies picked by maven depends from what is available on maven central on that day.
You need to solve conflicts.
You are potentially the first trying out a combination.
This is why I always use a set of projects that were released together. By the way this is also how the Eclipse project itself is doing it (by using P2 update sites and target platform).
I am publishing Maven BOM files to fix the versions: ECentral project
This is how you can do it:
<repositories>
<repository>
<id>ecentral</id>
<url>https://raw.githubusercontent.com/jmini/ecentral/HEAD/repo</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>fr.jmini.ecentral</groupId>
<artifactId>eclipse-platform-dependencies</artifactId>
<version>4.14</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<!-- no version needed here, because it is defined in the BOM -->
</dependency>
</dependencies>
Because I ran into this problem today too, but via plugin sub-dependency, my temporary solution is to download the regular org.osgi:org.osgi.service.prefs:jar:1.1.2 and install it in the local repository as org.osgi.service:org.osgi.service.prefs:jar:1.1.2.
You can exclude the dependency like this :
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.24.0</version>
<exclusions>
<exclusion>
<groupId>org.osgi.service</groupId>
<artifactId>org.osgi.service.prefs</artifactId>
</exclusion>
</exclusions>
so the reason for this failure is dependency
<groupId>org.osgi.service</groupId> <artifactId>org.osgi.service.prefs</artifactId>
but the group org.osgi.service doesn't exists, instead it is only org.osgi
so dependency should look
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.prefs</artifactId>
I have got the same problem today in our SpringBoot project 1.5.25 with org.hibernate:hibernate-tools:jar:5.0.6.Final
The error message as follow:
# Failed to collect dependencies at org.hibernate:hibernate-tools:jar:5.0.6.Final ->
# org.eclipse.jdt:org.eclipse.jdt.core:jar:3.12.2 ->
# org.eclipse.platform:org.eclipse.core.resources:jar:3.11.1 ->
# org.eclipse.platform:org.eclipse.core.expressions:jar:3.5.100 ->
# org.eclipse.platform:org.eclipse.core.runtime:jar:3.12.0 ->
# org.eclipse.platform:org.eclipse.equinox.preferences:jar:3.10.0 ->
# org.osgi.service:org.osgi.service.prefs:jar:[1.1.0,1.2.0): No versions available for org.osgi.service:org.osgi.service.prefs:jar:[1.1.0,1.2.0) within specified range -> [Help 1]
I use the private nexus, to resolve this problem, i added a proxy maven2 (maven-ecentral) repo pointed to https://raw.githubusercontent.com/jmini/ecentral/HEAD/repo , thanks #Jmini
then added the follow lignes in the pom.xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>fr.jmini.ecentral</groupId>
<artifactId>eclipse-platform-dependencies</artifactId>
<version>4.14</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>ecentral</id>
<url>https://nexus.xxxx.xxx/repository/maven-ecentral/</url>
</repository>
</repositories>
Reload your project with IDEA, it should work.
Another solution is using exclusions
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-tools</artifactId>
<version>${hibernate-tools.version}</version>
<!-- exclure the old org.eclipse.platform -->
<exclusions>
<exclusion>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.preferences</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- the 3.10.1 org.eclipse.platform fixed the pb -->
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.preferences</artifactId>
<version>3.10.1</version>
</dependency>
Even I have been facing this problem since today, it was working fine till yesterday.
Finally what I found was that pom of org.eclipse.equinox.preferences:3.10.0 group id mentioned as org.osgi.service, but the artifact is located in repo1.maven.org at org/osgi, there is no service folder in it.
I changed dependency group id to org.osgi in the pom of org.eclipse.equinox.preferences and then it worked.
--EDIT--
I can see a new version of 3.10.1 added in repo which has the group id corrected to org.osgi instead of org.osgi.service
I ran into this problem with a maven plugin (net.revelc.code.formatter). We use it from another maven plugin that generates code. Since it is just a formatter for generated code, my solution was to drop the usage of the formatter plugin. Obviously I couldn't use the above solutions, because I don't want to fork the formatter code.

java.lang.NoSuchMethodError: com.google.gson.Gson.newBuilder()Lcom/google/gson/GsonBuilder;

I'm trying to use Unirest in my program but I keep getting this error java.lang.NoSuchMethodError: com.google.gson.Gson.newBuilder()Lcom/google/gson/GsonBuilder;
I have tried using different maven versions of Gson but I still continue to get this seror
Edid added my pom.xml, I tried deleted my .m2 but I am still having this problem
<dependencies>
<!-- https://mvnrepository.com/artifact/com.konghq/unirest-java -->
<dependency>
<groupId>com.konghq</groupId>
<artifactId>unirest-java</artifactId>
<version>3.7.00</version>
<classifier>standalone</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>[4.0,)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>Spigot8</artifactId>
<version>1.8</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/spigot-1.8.8-R0.1-SNAPSHOT-latest.jar</systemPath>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>LATEST</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
<scope>compile</scope>
</dependency>
</dependencies>```
Could be a conflict between the GSON versions in your POM file versus what is in your container (Tomcat/JBoss) etc. Inspect the JARS in WEB-INF/lib. If there are two different versions, then delete the one which is not the same as the one currently in your maven project's POM file. I had a similar issue - my project was using gson-2.6.3.jar but a conflicting gson-2.1.jar also existed in WEB-INF/lib. I deleted gson-2.1.jar and this resolved my problem
This issue is possibly due to conflicts in Gson versions.
Go to your repository if you are on windows:
C:\Users\User_name.m2\repository\com\google\code\gson
or on Mac:-
/.m2/repository/com/google/code/gson
Delete all the existing folders.
Now, add below maven dependency in your pom file:
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
Re-build your maven project and try to run.
It seems like a dependencies issue.
Please make sure your dependencies are correct. Unirest 3.7.00 uses Gson 2.8.6
https://mvnrepository.com/artifact/com.konghq/unirest-java/3.7.00
Also, if you don't use Gson separately you don't need to specify it. Just add a dependency for unirest-java as it's described in Maven repository:
<dependency>
<groupId>com.konghq</groupId>
<artifactId>unirest-java</artifactId>
<version>3.7.00</version>
</dependency>

Not able to find artifact jackson-modules-java8 jar

I am using pom.xml like
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-parameter-names</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
but there is no .jar available in public repo. It have only .pom file in respective release. Public maven repository link
How to get .jar for it.
You can manually download .zip for respective release from jackson-modules-java8/releases
and build it locally using command.
mvn clean install
It will give you .jar for each module under respective target directory.
You need to also include that dependency in your pom.xml:
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-modules-java8</artifactId>
<version><!-- same version as your other jackson dependencies --></version>
</dependency>

How to update rich-faces library version?

In my maven-project there are three dependencies corresponding to RichFaces:
<dependency>
<groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-api</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-impl</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-ui</artifactId>
</dependency>
And in the root of my eclipse project MavenDependencies branch contains richfaces-api/ui/core -3.3.3. How can I change the pom to upload latest available version? The thing is there is no version defined anywhere in the pom.
There has to be a version defined otherwise it would not work. Eclipse will tell you what version you're using and where to find the definition if you hover over the dependency.
I Think there's a bom dependency somehwere in your pom such as this
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>BOM-VERSION</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Update the BOM-VERSION part to something new such as "4.3.7.Final".

building maven project when adding dependency on parent jar

Hi guys wondering if you can let me know where I am going wrong.
In my pom.xml I added a dependency for org.powermock:powermock-mockito-release-full:jar:1.5.4
via the following:
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-mockito-release-full</artifactId>
<version>1.5.4</version>
<scope>test</scope>
</dependency>
Now during a build I get the error "Could not resolve dependencies for project com.law:test_pro:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.powermock:powermock-mockito-release-full:jar:1.5.4"
In my local repository I have all jars for containing sub-projects but no jar for the parent jar which the build process seems to be looking for.
There is only a parent pom file available for the Maven co-ordinate
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-mockito-release-full</artifactId>
<version>1.5.4</version>
<scope>test</scope>
</dependency>
Hence, you need to add the type 'pom' to this like so:
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-mockito-release-full</artifactId>
<version>1.5.4</version>
<scope>test</scope>
<type>pom</type>
</dependency>

Categories

Resources