Build issue Spring 3 -hibernate 3 Project - java

I have a simple spring3,hibernate 3 project.When am trying to build the project using Maven i got the following errors.
Downloading: http://repo1.maven.org/maven2/org/hibernate/hibernate-entitymanager/3.3.2.ga/hibernate-entitymanager-3.3.2.ga.jar
[INFO] Unable to find resource 'org.hibernate:hibernate-entitymanager:jar:3.3.2.ga' in repository central (http://repo1.maven.org/maven2)
[INFO] Failed to resolve artifact.
Missing:
1) org.hibernate:hibernate-entitymanager:jar:3.3.2.ga
Anybody know what is the issue, i put anything wrong in my POM.xml.
If i downloaded the jar file, how i added to Maven through my eclipse
Help is highly appreciated,
VKS

You could use http://mvnrepository.com to search for hibernate-entitymanager. Your version looks like this: Do note the upper case in GA ...
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.3.2.GA</version>
</dependency>

For hibernate we use following repository:
https://repository.jboss.org/nexus/content/repositories/releases/
Try adding this to your pom:
<repository>
<id>jboss.org</id>
<name>JBoss Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
</repository>

Related

What repository does tidyverse require in pom.xml when using Renjin?

I'm following the "R for Data Science" tutorial for using the tidyverse. Because I'm eventually going to create a data analysis program in Java using Renjin, I need to be able to use the tidyverse's packages in my Maven project in Eclipse.
I've added the following dependencies in pom.xml:
<dependencies>
<dependency>
<groupId>org.renjin</groupId>
<artifactId>renjin-script-engine</artifactId>
<version>3.5-beta76</version>
</dependency>
<dependency>
<groupId>org.renjin.cran</groupId>
<artifactId>tidyverse</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
I'm positive that the first dependency (renjin-script-engine) works. And I'm pretty sure the second dependency works as well. But whenever I run pom.xml and use the Maven test feature, it gives me the following error (I shortened it to just the important part):
[ERROR] Failed to execute goal on project Test1: Could not resolve dependencies for project Tests:Test1:jar:0.0.1-SNAPSHOT: org.renjin.cran:tidyverse:jar:1.3.2 was not found in https://nexus.bedatadriven.com/content/groups/public/ during a previous attempt.
I'm assuming that this error means I need another repository for tidyverse. Here is my current repository, which I got from the Renjin instructions:
<repositories>
<repository>
<id>bedatadriven</id>
<name>bedatadriven public repo</name>
<url>https://nexus.bedatadriven.com/content/groups/public/</url>
</repository>
</repositories>
(here's the link to those instructions as well: http://docs.renjin.org/en/latest/library/project-setup.html#maven)
I am not sure what repository I need to add.
Thank you for reading. I am a beginner, and I really appreciate any and all help.

Maven add external jar

I would like to add the following jar
gson-extras-1.0-SNAPSHOT.jar
the jar structure is the following
looking at the manifest the version is
Manifest-Version: 1.0
the pom is the following
<repositories>
<repository>
<id>grupoicarep</id>
<url>file:///C:/stix/stix_ica/stix2/lib/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.google.gson</groupId>
<artifactId>typeadapters</artifactId>
<version>0.1</version>
</dependency>
but it shows the following error:
Failed to execute goal on project stix2: Could not resolve dependencies for project es.grupoica:stix2:jar:0.0.1-SNAPSHOT: Failure to find com.google.gson:typeadapters:jar:0.1 in file:///C:/stix/stix_ica/stix2/lib/ was cached in the local repository, resolution will not be reattempted until the update interval of grupoicarep has elapsed or updates are forced -> [Help 1]
[ERROR]
I have tried many combinations but I am just guessing and not getting the right result
I don´t know what I am doing wrong
many thanks in advance
Ana
Use below dependency to include the jar available in the local machine to maven.
<dependency>
<groupId>groupid</groupId>
<artifactId>artifactid</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}\lib\JAR_NAME.jar</systemPath>
</dependency>

How to upload maven plugin to Github packages?

Consider I have a maven plugin project and I want to publish it to Github's public maven repository called "Github Packages". I've done everything by instruction and for normal projects everything works fine out of the box. But for maven plugin projects with packaging=maven-plugin the instruction doesn't work.
In build log I see something like this:
[WARNING] Could not transfer metadata repo-name/maven-metadata.xml
from/to github (https://maven.pkg.github.com/user-name/repo-name):
Failed to transfer file:
https://maven.pkg.github.com/user-name/repo-name/group-id/maven-metadata.xml.
Return code is: 422 , ReasonPhrase:Unprocessable Entity.
It seems the maven deploy plugin needs maven-metadata.xml in the group-id's root, but can't find it and no one puts it there. How to solve this problem?
I use Apache Maven 3.3.9, and use the command:
mvn clean deploy
--Addition: example of pom file I'm using:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>github</id>
<name>GitHub my_repo Apache Maven Packages</name>
<url>https://maven.pkg.github.com/my_nick/my_repo</url>
</repository>
</repositories>
<version>1.0.0</version>
<groupId>x</groupId>
<artifactId>some-plugin</artifactId>
<packaging>maven-plugin</packaging>
<dependencies>
<dependency>
<groupId>x</groupId>
<artifactId>my-dependency</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.github.javaparser</groupId>
<artifactId>javaparser-core</artifactId>
<version>3.15.12</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.6.0</version>
</plugin>
</plugins>
</build>
</project>
Unfortunately I haven't found the right answer to my question, it seems that for now it's impossible to add Maven plugins to Github Packages.
However I found a workaround which uses S3 as a repository backend, so you don't need heavyweight solutions like Nexus or JFrog. You can read this and this on how to do it.
I had the same problem 422 from server: Unprocessable Entity when publishing Maven artifacts from GitHub Actions to GitHub Packages. The reason was that the corresponding tag for the uploaded artifact didn't exist yet.
The error message may be better in this case.
If you have already uploaded the artifact to the GitHub Packages then it means you have configured everything right.
I suppose the real reason for the 422 error is that you are trying to upload the same artifact with the same version that already was uploaded. And if it is not a SNAPSHOT version then the repository should deny replacing it so it behaves correctly.
I got the same error when trying to redeploy the already deployed package:
Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project MavenPluginForGithub:
Failed to deploy artifacts: Could not transfer artifact ru.dmochalov:SampleMavenPluginForGithub:jar:1.0.3 from/to github (https://maven.pkg.github.com/dmochalov/hello-world):
Failed to transfer file: https://maven.pkg.github.com/dmochalov/hello-world/ru/dmochalov/SampleMavenPluginForGithub/1.0.3/SampleMavenPluginForGithub-1.0.3.jar.
Return code is: 422, ReasonPhrase: Unprocessable Entity. -> [Help 1]
How to fix?
Is suppose you have two options:
Increment the version <version>1.0.0</version> of the plugin from 1.0.0 to 1.0.1. Consider using 1.0.1-SNAPSHOT versions if the plugin is unstable and under development. GitHub allows redeploying artifacts with SNAPSHOT versions. So you could always redeploy it when developing.
Delete the package from the repo. You can do it only for packages in a private repository.
422 error vs 401 error
I suppose that there is not accepted specification or standardization for error codes and different repositories behave differently. For example, the Maven Central repository replies with 401 error when attempting to replace the already deployed version.
Why GitHub decided to use 422 is a mystery. There is an answer in the community forum but without proper explanation.
Here's the official github link for how to do exactly that. However, since this doesn't seem to be of much help, here's a link to a gradle forum question that should help you with this. Best of luck!

How to use de.entropia.can package in pom.xml file

I'm trying to use this github repo: https://github.com/entropia/libsocket-can-java in pom.xml file. I couldn't find any maven dependency for this github repo. I added jitpack repository and maven dependency to pom file by following this link: https://jitpack.io/p/entropia/libsocket-can-java. Here is my code:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.entropia</groupId>
<artifactId>libsocket-can-java</artifactId>
<version>4433bb7</version>
</dependency>
where 4433bb7 is the latest commit number. I get this error when I try to build:
Missing artifact com.github.entropia:libsocket-can-java:jar:4433bb7
Could not resolve dependencies for projec: Failure to find com.github.entropia:libsocket-can-java:jar:4433bb7 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]
I tried with bundle versions: 0.1.0, 1.0.0 still no luck. Please help me to resolve this issue. Thank you all in advance.
Seems issue with the specific version. try latest snapshot:
<dependency>
<groupId>com.github.entropia</groupId>
<artifactId>libsocket-can-java</artifactId>
<version>master-SNAPSHOT</version>
</dependency>

Could not resolve dependencies: org.springframework.transaction

I am not super confident in my understanding of Maven so bear with me:
My POM:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.transaction</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
Build:
[WARNING] The POM for org.springframework:org.springframework.transaction:jar:3.2.4.RELEASE is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.427 s
[INFO] Finished at: 2016-12-02T15:22:42-08:00
[INFO] Final Memory: 7M/77M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project PROJECT: Could not resolve dependencies for project PROJECT:jar:1.0: Failure to find org.springframework:org.springframework.transaction:jar:3.2.4.RELEASE in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of maven2 has elapsed or updates are forced -> [Help 1]
Looking in http://repo1.maven.org/maven2 this makes sense. org.springframework.transaction is indeed not present in the repository. So I went to this page and noticed that it says the artifact lives in the following repository:
https://artifacts.alfresco.com/nexus/content/repositories/public/
This time, looking through the repository I did find org.springframework.transaction at the directory matching the groupId and artifactId specified in my POM.
https://artifacts.alfresco.com/nexus/content/repositories/public/org/springframework/org.springframework.transaction/
However there is clearly no 3.2.4.RELEASE here. My co-worker's are able to build the project (though it has been some time since they checked it out fresh) and they remember running into a similar issue. I am a little confused as to why this feels like a repository issue though when we are all running the same POM.
As an aside, there are multiple other org.springframework dependencies that are resolving appropriately and I can see them in my ~/.m2, just not this one.
The org.springframework.transaction has the spring-tx artifact id.
I use this snippet in my pom and works seamlessly:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.2.4.RElEASE</version>
</dependency>
Ended up being an issue to having spring-context dependency in my pom. Apparently that does stuff for you? Getting rid of both spring-tx and org.springframework.transaction actually allowed them to be downloaded and accessed properly.
As #Vadim just answered, you just need to add your custom repo to your pom.
<repositories>
<repository>
<id>alfresco</id>
<name>your custom repo</name>
<url>http://repository.springsource.com/maven/bundles/releas‌​e</url>
</repository>
</repositories>
And then you can get your dependency by using:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.transaction</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
You can view the repository contents by using this link https://artifacts.alfresco.com/nexus/#nexus-search;quick~transaction
Also be carefull not to run maven with -o flag( or in offline mode ) for the first time in order to let maven to download the dependency.
Your .m2 does not have it and Maven tries to get it from defined repositories. You do not have them or you do not have a connection from Maven. (it is more likely from what error says as I remember). are you behind the proxy?
You need to define additional repositories. either in ~/.m2/settings.xml or inside POM on project level.
Something like that:
<repositories>
<repository>
<id>fuse-public-repository</id>
<name>FuseSource Community Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repositories>
in settings.xml usually in one of the active profile element.
In POM just inside project.
PS. be sure you have connection to the repository URL. If you are behind proxy you need to define it as well in settings.xml

Categories

Resources