how to download and install jar in my local repo Maven - maven-2

I am trying to download a jar for an internal repo with I have under tomcat and then install it to my local maven repo.
The jar file can be found under the path:http://10.11.250.14/strepo/ext/JSErrorCollector-0.2.jar.
I edit my pom.xml providing the link of the internal repo and also add a dependency in the pom.xml but the maven cannot download the jar.
<repositories>
<repository>
<id>internal.repo</id>
<url>http://10.11.250.14/strepo/ext/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.JS</groupId>
<artifactId>JSErrorCollector</artifactId>
<version>0.2</version>
</dependency>
Could you please anyone help me?

It's not just the jar only to make a Maven repository, there are a bunch of other stuffs required to be regarded as Maven repository. From the URL I think it is not a standard Maven repository layout.
So you have at least 2 options:
Setup your own local network Maven repository, either using Artifactory, Nexus or other similar software systems.
Download the file and add it to your local machine repository.
For option 2, just download the file, and then run the Maven mvn command as follow (assuming the file is at your current directory):
mvn install:install-file -Dfile=JSErrorCollector-0.2.jar -DgroupId=strepo.ext -DartifactId=JSErrorCollector -Dversion=0.2 -Dpackaging=jar
After that you can refer to that using:
<dependency>
<groupId>strepo.ext</groupId>
<artifactId>JSErrorCollector</artifactId>
<version>0.2</version>
</dependency>

Related

Dropbox sdk repository maven

Even if it sounds like a silly question, I am not able to find the repository where the dropbox sdk is. So in my pom.xml I have declared this dependency:
<!-- Dropbox dependency -->
<dependency>
<groupId>com.dropbox</groupId>
<artifactId>client2</artifactId>
<version>1.3</version>
</dependency>
But it can not be found in this repository:
<repository>
<id>dropbox-client2</id>
<url>http://getdropbox.com/developers/</url>
</repository>
Thanks
Dropbox just release the version 1.6 of it SDK in Java.
And this time they made it available on Maven repository.
<dependency>
<groupId>com.dropbox.core</groupId>
<artifactId>dropbox-core-sdk</artifactId>
<version>1.6</version>
</dependency>
Checkout for futher updates:
http://mvnrepository.com/artifact/com.dropbox.core/dropbox-core-sdk
The official dropbox API is not publish on Maven central repository.
I repackaged it and published on Maven central.
You'll find instruction to add to your project here : https://github.com/vanduynslagerp/dropbox-java-sdk#readme
You can install it on your own repository with:
https://gist.github.com/4543727
Right now, dropbox sdk is version 1.5.3 but you can pass a parameter to retrieve older ones.

SmartGwt 2.4 with Maven on Eclipse

Could Smartgwt 2.4 be usable with maven.
I take “Missing artifact com.smartgwt:smartgwt:jar:2.4:compile” error When give smartgwt version “2.4″. “2.0″ is ok but 2.2 and above gives error.
dependency;
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>2.4</version>
</dependency>
repo;
<repository>
<id>smartclient</id>
<name>smartclient.com</name>
<url>http://www.smartclient.com/maven2</url>
</repository>
Download the desired version of smartgwt.jar and smargwt-skins.jar and upload them to your own repository, such as nexus (http://nexus.sonatype.org/) and configure maven to use the resources from that repository as well.

How to bundle JNLP API with Maven Project

I have a project where I need the JNLP API. I did not find an artifact for that on Maven Central, so I added an external Repository which offers that to my pom. That repository went offline this weekend. This is the second time something like this happened to me.
I know this is pretty much what Maven is not about, but really I just want that tiny jnlp-api-1.5.0.jar file to be
In my SCM (I don't want to roll my own Maven repository for just one dependency).
In the compile scope when the project builds.
Which knobs do I have to turn to accomplish this?
As of JDK 7.0, the JNLP API is being provided by the javaws.jar file in your JRE's lib directory, i.e., ${java.home}/lib/javaws.jar. It is possible to use the maven dependency scope system.
<project>
...
<dependencies>
<dependency>
<groupId>javax.jnlp</groupId>
<artifactId>jnlp-api</artifactId>
<version>7.0</version>
<scope>system</scope>
<systemPath>${java.home}/lib/javaws.jar</systemPath>
</dependency>
</dependencies>
...
</project>
You can put the JAR in your local repository using the install-file goal of the maven-install-plugin and reference it as you normally would in your POM. The command would be:
mvn install:install-file -Dfile=/path/to/jnlp-api-1.5.0.jar -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=1.5.0 -Dpackaging=<packaging>
Place this command in a script and check it into your SCM. That way, you (and anyone else working on this project) can install it easily to the local repo.

java.net maven repo - JMS artifact missing

I just created a new Maven project using the default archetype and added the following dependency to my POM file.
<dependencies>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
Realizing that the Sun's JARs are not on Maven central due to licensing issues, I added
the following Maven repo to my POM (I know this is bad practice though and that it needs to be added to a settings.xml)
<repositories>
<repository>
<id>Repo ID</id>
<layout>default</layout>
<name>Java.net Maven repo</name>
<releases>
<enabled>true</enabled>
</releases>
<url>http://download.java.net/maven/2/</url>
</repository>
</repositories>
I still see this error in my POM file.
"Missing artifact javax.jms:jms:jar:1.1:compile"
Does anyone here know what else needs to be done in addition to the config I already have?
Realizing that the Sun's JARs are not on Maven central due to licensing issues, I added
the following Maven repo to my POM
Yeah, but http://download.java.net/maven/2/javax/ doesn't have the jms artifact...
The good news is that the JBoss Nexus repository does have it:
<repository>
<id>repository.jboss.org-public</id>
<name>JBoss repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
</repository>
If you just want the jms artifact and don't want to add the whole repo, you can do the following:
wget https://repository.jboss.org/nexus/content/groups/public/javax/jms/jms/1.1/jms-1.1.jar
mvn -e install:install-file -Dfile=./jms-1.1.jar -DartifactId=jms -DgroupId=javax.jms -Dversion=1.1 -Dpackaging=jar
In fact the real solution for this issue is to use the jms-api-1.1-rev-1.jar artifact available on Maven Central : http://search.maven.org/#artifactdetails%7Cjavax.jms%7Cjms-api%7C1.1-rev-1%7Cjar

Maven 2 Checkstyle configLocation

I have a project which has as maven dependency a jar file which includes a xml file where I stored my rules for checkstyle. I thought it would be ok to just use this configuration:
<configLocation>mycheckstyle.xml</configLocation>
My understanding is that the file should be searched on the classpath and my jar file is a Maven dependency so it should be found, however I get a resource not found exception.
Any suggestions?
Try adding a dependencies section to your plugin configuration.
E.g.,
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.example.whizbang</groupId>
<artifactId>build-tools</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>
See Maven Checkstyle Plugin - Multimodule Configuration for more information.
As explained in the Checkstyle plugin page,
configLocation :
Specifies the location of the XML configuration to use.
Potential values are a filesystem path, a URL, or a classpath resource.
I never did that on my project...
Are you sure that the JAR containing the XML file is in the classpath when the checkstyle plugin is starting?
I'm having a parent which specifies the checkstyle plugin and has in its resource folder the appropriate mycheckstyle.xml. I use the maven assembly plugin to make a jar of my parents resource folder and define that jar as a dependency in my child. So when the child inherits the checkstyle plugin + it's configuration from the parent it should be able to find the mycheckstyle.xml. I have followed the instructions on the checkstyle plugin page but it didn't work.
If you have a local maven repository for your self-created and compiled checks, please be aware to not forget defining
<repositories>
<repository>
<id>my local repository</id>
<url>file:${basedir}/.m2artifacts</url>
</repository>
<!-- ... -->
</repositories>
but also
<pluginRepositories>
<pluginRepository>
<id>my local repository</id>
<url>file:${basedir}/.m2artifacts</url>
</pluginRepository>
<!-- ... -->
</pluginRepositories>
otherwise the plugin dependency will just look in central maven repo but will not find your local JAR file with your check-classes