I can't get the maven dependency for ucanaccess to work:
net.ucanaccess
ucanaccess
2.X.X
It doesn't seem to be available?
It appears that ucanaccess is not currently available from maven central (based on googling for it and finding this thread).
I'd recommend downloading it from sourceforge, extracting the jar, and installing the jar in your local repo using the instructions from the maven documentation:
mvn install:install-file
-Dfile=<path-to-file>
-DgroupId=<group-id>
-DartifactId=<artifact-id>
-Dversion=<version>
-Dpackaging=<packaging>
-DgeneratePom=true
Where: <path-to-file> the path to the file to load
<group-id> the group that the file should be registered under
<artifact-id> the artifact name for the file
<version> the version of the file
<packaging> the packaging of the file e.g. jar
Did you look on http://mvnrepository.com/ to check whether your dependency is present or not ?
If not you should drop the jar in your classpath by yourself or create the appropriate directory in your local maven repository at %HOME%.m2\repository.
Related
I am trying to install a local jar file to be used as a dependency using the following command
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=<path-to-file>
Getting the following result
The goal you specified requires a project to execute but there is no POM in this directory
To install the file in the local maven repository, you have to provide also the group ID, artifact ID, and the version for that file. Without them, Maven does not know in what directory to store the file.
See also: https://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html.
Maven need the so called GAV coordinates: groupId, artifactId, version and packaging to store the artefact.
You can name them wiht the install command
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file
-Dfile=<path-to-file>
-Dpackaging=jar
-DgeneratePom=true
-DgroupId=<groupId> -DartifactId=<artifactId> -Dversion=<version>
I am converting a local Spring boot Jar app to a War build , using an external TomCat server.
Spring Boot app is running using 2 3rd party jars placed in libs folder.
I am facing an issue trying to include these 2 jars to the final war.
Added these jars to the ClassPath intelliJ Artifact settings but no luck.
Tried putting them manually in WEB-INF/lib folder but no luck.
Tried the above method.
<dependency>
<groupId>myJarGroup</groupId>
<artifactId>myJarArtifact</artifactId>
<version>>1.7.0.1</version>
<scope>compile</scope>
<systemPath>${project.basedir}/src/main/resources/xxx/myjar.jar</systemPath>
</dependency>
Again no luck.
WEB-INF/lib is still missing my 2 jars.
Only a type can be imported. ec.ec.ada.ec.common.ec.code.testValidate resolves to a package
testValidate cannot be resolved
Error importing : 'ec.ec.ada.ec.common.ec.code.testValidate'
You will have to incluse these two jars as dependency in pom. I know this is 3rd party depencdency but you can add it like below:
mvn deploy:deploy-file -Durl=file:///path/to/yourproject/repo/ -Dfile=mylib-1.0.jar -DgroupId=com.example -DartifactId=mylib -Dpackaging=jar -Dversion=1.0
This way they will be saved in maven repository and maven war plugin will include same in war that will be generated for deployment.
Here you go!
Although rarely, but sometimes you will have 3rd party JARs that you
need to put in your local repository for use in your builds, since
they don't exist in any public repository like Maven Central. The JARs
must be placed in the local repository in the correct place in order
for it to be correctly picked up by Apache Maven. To make this easier,
and less error prone, we have provide a goal in the
maven-install-plugin which should make this relatively painless. To
install a JAR in the local repository use the following command:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
With version 2.5 of the maven-install-plugin it gets even better. If
the JAR was built by Apache Maven, it'll contain a pom.xml in a
subfolder of the META-INF directory, which will be read by default. In
that case, all you need to do is:
mvn install:install-file -Dfile=<path-to-file>
From a Maven Guide to installing 3rd party JARs.
How do i use Jar files as a dependency using IntelliJ with Maven? I have some jar's containing API codes but when I put them in my external library it gives an error saying it's missing.
The easiest way to do it is by installing the jar file in your local Maven repository, as JB Nizet already mentioned:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
See also How to add local jar files in maven project?
This works fine as long as you are only using your local Maven repository. However when others should be able to build your project, they will run into the same problem. So here the easiest way would be to install the jar file in proxy Maven repository if you have one (many companies do).
You could also reference the jar file as a system dependency:
<dependency>
<artifactId>..</artifactId>
<groupId>..</groupId>
<scope>system</scope>
<systemPath>${basedir}/lib/dependency.jar</systemPath>
</dependency>
There is also a very nice alternative: Maven: add a dependency to a jar by relative path
i have created a jar with name jarFile.jar, as you can see i haven't mentioned any version of the jar which is creating problem while i trying to add this jar to pom.xml without changing the name of the jar
`<dependency>
<groupId>com.my.jar</groupId>
<artifactId>jarFile</artifactId>
<version></version>
</dependency>`
If you don't specify version, maven can't know which jar to take.
Specify the version of the jar you installed.
The procedure to install a jar i use is:
mvn install:install-file -DgroupId=com.example -DartifactId=awesomeJar -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true -Dfile=C:\myJar.jar
(for external jars)
or
mvn clean install -o
from the project folder for installing my own dependency jars.
I don't see the real question here.
I have created the jar through maven from some other project. The jar reside in the location repository. The jar contains the pom.xml file in META-INF/maven///pom.xml
and pom.properties.
I have also copied the pom.xml file while running the pom for that project using resource-copy
plugin. Still I am getting the below warning , there fore during the building of war the maven not able to include all the dependent jars of the above jars in the war file. Other option is to add thoses jars as a runtime dependency in my war pom file.
[WARNING] The POM for org.artifact:runtime.ui:war:1.0.0-SNAPSHOT is missing, no dependency information available
I found that only goal packaging will put the artifact in a local repository. But then for each artifact I need to do the install so that it will get in the files system repository with the pom file. Copying the pom file using resource plugin will not help.
Hi you need to install the specific jar to your local repository (for a start).
If this jar is properly packaged using maven you can issue the following command from the terminal:
mvn install:install-file -Dfile=<path-to-file>
If it is custom made you need to include the required parts like
mvn install:install-file -Dfile=<path-to-file>
-DgroupId=<group-id>
-DartifactId=<artifact-id>
-Dversion=<version>
-Dpackaging=<packaging
Please see the official documentation here.
Hope it helps