From hibernate.org: http://hibernate.org/validator/documentation/getting-started/
I saw Prerequisites:
Java Runtime >= 6,
Apache Maven
However, "maven" is not even mentioned in the following:
http://www.aviyehuda.com/blog/2010/04/14/using-hibernate-validator-to-cover-your-validation-needs/
Our current project is not maven-based, a student project. Could we still use hibernate validator without using maven? Or is there any better choice for hibernate validation?
Maven is not required. The main reason you want to use Maven is that it makes downloading all the package dependencies super easy.
If it's just a small student project, and you don't want to use Maven, then just download the jars that you would otherwise have downloaded with Maven.
You can manually download the jar files here : http://hibernate.org/orm/downloads/
Maven is optional. But it's a very helpful tool for building Java projects (via many phases like compile, test, package, install...). You'd better learn to use it.
In your question, the hibernate-validator jar will depend on other jars such as hibernate-jpa, validation-api, joda-time...
It means you can not run your project with only hibernate-validator jar file. You need to collect all the required jars together.
Maven will automatically resolve it for you.
You can download from:
https://repo1.maven.org/maven2/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final.jar
Then add this file jar to your project manually. As you seen, downloading jar file is an alternative way when not using Maven.
Related
I am currently using the Eclipse IDE and want to import an external java project so that I can use it in something I am working on. I downloaded the directory of icePDF, found here, and would like to use the java class file "SwingViewBuilder.java" that is found in the directory I linked at "/icepdf/branches/icepdf-6.2.5/icepdf/viewer/src/org/icepdf/ri/common". I have tried some basic things like importing the folder itself, but it did not work.
I would highly suggest using a dependency management tool like Maven or Gradle to download this dependency and any other dependencies you may have into your project for you.
Here is the maven getting started guide: https://maven.apache.org/guides/getting-started/
And here is the maven dependency for you to add to your pom.xml file: https://mvnrepository.com/artifact/org.icepdf.os/icepdf-viewer/6.2.2
If you specifically need version 6.2.5, you will need to build the icePDF project yourself and configure your class path to use it as a dependency.
Recently I have begun working on a Java Spring project that does not use Maven and I need to build elasticsearch functionality into the program but I cannot find any information about how to import elasticsearch without the use of Maven.
Has anyone ever had to do something similar?
Is it maybe possible to just use Maven on this one part of the project?
Thank you for any help.
Maven just provide you a way to manage your dependencies. So, if you manage your dependencies in directly downloading JARs, you just have to download all the dependencies you needs and include them in your classpath.
As #Camille Gerin-Roze said , all you need is to download the ElasticSearch dependencies and add them to the classpath.
A place to start is :
https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch/2.3.5
And using the "Download Jar" link
If you scroll down and read the part that says "Compile Dependencies (32)" , it will tell you what other dependencies you need to download manually and add to the class path.
Please note that each of these dependencies may or may not have co dependencies that you may need to download and add to the classpath as well.
I am new to writing build files and currently I am writing the ant for my project. The issue I am facing is to include the jar to in ant build file.
As per the standard 'ant build' the jars need to be kept in lib folder. But the issue is the jar is very huge, more than 100 GB of size and hence cannot be kept in GitHub.
I have put that in another repository and want to include that in my build file.
Could anyone please let me know how to include the jars in my 'pathelement location' from the url.
Apache ivy is a 3rd party dependency manager, a powerful feature built into more modern Java build tools like Maven and Gradle.
The following answer gives a detailed example, using ivy to manage classpaths and help in the creation of an executable jar.
Class not found with Ant, Ivy and JUnit - error in build.xml?
You mentioned the use of another repository. Presumably this is a Maven repository manager like Nexus or Artifactory. Ivy is capable of downloading from these. (which would be another question :-))
I have been trying to use the vget library/api to make my own youtube video downloader. The vget library can be found here: https://github.com/axet/vget
I have downloaded the zip on github and I imported the project into eclipse. However, I am confused to how I am supposed to properly use this API. Should I make a completely new project, and import the classes that I need or do I put my own source files in the project of the api?
I have read other threads concerning this problem. However, they all mention how a api is typically packaged in a JAR file, but in my case it is just files and classes. So I am confused to how I should properly use this api.
The vget project is a maven project. You can see that because it has a pom.xml file in the root folder of the project.
To use it, you don't even need to download the source, because the compiled jar files are already stored in the central maven repository. You can find more information about this here:
http://mvnrepository.com/artifact/com.github.axet/vget/1.1.23
(in general, you can use the http://mvnrepository.com/ site to search whether your library is available on the maven central repository. If it's even a mildly popular library, then chances are that it is)
What you need to do is to make your own project a maven project.
Here's a "5 minutes" starter guide that describes how to do that.
When you've done that, you just add the dependency on vget to your pom.xml file in the <dependencies> section:
<dependency>
<groupId>com.github.axet</groupId>
<artifactId>vget</artifactId>
<version>1.1.23</version>
</dependency>
Since you are making use of a 3rd party software, and not extending it with your own logic, the way to go is to create a new project, which references the 3rd party software.
You then construct your application and make it do whatever you need it to do. When it comes to using logic which is available within the 3rd party logic, you would then simply delegate that call to the 3rd party library.
I have seen on the link you have provided, that this is a maven project. You have to execute a maven package command, or maven install, so that the jar file will be generated.
With this jar follow the Bill's instructions, and add it as external library to your claspath.
When you do this, you will be able to invoke methods of that api.
Let us know if you need some help doing this in eclipse.
If your project is a maven project, you can solve dependencies problems just adding the dependency written on Readme file to your pom file.
The easiest and most automatic way is to use something like maven, ant, or gradle, that will automatically download and put the jars in to your classpath if they are in the central repositories. For example, in the maven configuration file(pom.xml) you can add this to the dependency list:
VGet Maven Repository
These build tools also allow you to add external jars if needed.
If
I would suggest you get familiar with Maven. At the bottom there is a Maven dependency you just have to include into your pom.xml, and then you can use the extension immediately.
Maven is a build platform which organizes your project in a technical way (convention over configuration, e.g. code is in /src/main/java, tests are in /src/test/java). The proper way is it to create a Maven project in Eclipse (you have to install the plugin and download Maven as well) and put the dependency
<dependency>
<groupId>com.github.axet</groupId>
<artifactId>vget</artifactId>
<version>1.1.23</version>
</dependency>
into your <dependencies> inside your pom.xml. After adding it, you project recognizes the additional package automatically.
Nobody tinkers by adding libraries manually. It's actually not professional to work without a build platform like Maven or Gradle.
I've been asked to apply Maven to a project. After browsing a dozen sites it appears that it's quite vast and I'm not familiar as I'd like with similar tools like Ant. Why is it used/preferred and what does it offer over a standard Eclipse project? Also, how could it be added to an existing project?
Why is it used/preferred and what does
it offer over a standard Eclipse
project?
It is a build tool which can build your project without the need for an IDE like Eclipse. It can create a jar or war or other artifacts from the source, performing a bunch of steps like compilation, running unit tests, etc.
Where maven scores over ant is in managing third-party dependencies and in convention over configuration (which mean less lines of build script if you follow convention).
Also, how could it be added to an
existing project?
You start by creating a new maven project, following the step here.
Place it in the root folder of your project
If your source and resource files do not follow maven folder convention, update maven properties suitably referring to this documentation.
Run mvn package
It will fail if it needs any third party dependencies, which you can add as specified in the doc
With some trial and error, you should have your project running with maven, possibly, much quicker than if you were to set up the same with ant.
Others are already provided sufficient resources to read more about maven.
I suggest to start reading here:
http://www.sonatype.com/books/mvnref-book/reference/public-book.html
Maven is a great tool when you know how to use it. Maven (at core) is a dependency manager.
You include in your pom.xml (similar in function to the build.xml from Ant) all the librairies your project depends on (example : apache commons) along with their version and Maven get them directly from a repository (by default, the central maven repository)
Then you do not have to manually install any jar to make your project work. All is downloaded and cached on your local machine. You can even create an enterprise repository where you put all the jars needed by your company
Maven uses the concept of artifacts which are pre-built library projects with their own dependencies
To mavenize a project, you'll have to write a pom.xml describing your project (examples are numerous), get rid of your libs directory (or whatever classpath you described under Eclipse) and add all your dependencies to your pom.xml
You could also check Mavenizer for a first-start
But Maven is a lot more what i've just said. Read the docs, read poms from librairies and you'll get used to it quickly ;-)
If you use the M2Eclipse plugin from Sonatype, it's just a matter of right clicking the project in the package explorer and choosing Enable Dependency Management in the Maven menu. You are also advised to adjust the directories that contain the sources to the Maven standard directory layout but if you absolutely can't, you can configure that later.
Apart from that: Well, look for tutorials and documentation (for example there is the free book Better builds with Maven. Maven is very complex (yes, I don't think it is simple) and very powerful.