When I compile NebulaGraph Exchange, Connectors and Algorithm, the SNAPSHOT package can not be downloaded. It gives the hint:
Could not find artifact com.vesoft:client:jar:xxx-SNAPSHOT
Want to know why this hint is given. Is there any solution for this?
You need to add snapshots to the profiles of setting.xml to enable downloading SNAPSHOT from the repo.
<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
I am new to JIRA client usage. I am trying to create a REST client and create an issue in our JIRA. There are lot if example but none of them are working for me.
I am using mvn and eclipse on win7.
<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>
<groupId>jira</groupId>
<artifactId>jira-int</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>jira-int</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<name>Atlassian Public Repository</name>
<layout>default</layout>
<url>http://maven.atlassian.com/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
For any version eclipse giving error:
Description Resource Path Location Type
ArtifactDescriptorException: Failed to read artifact descriptor for com.atlassian.jira:jira-rest-java-client-core:jar:3.0.1: ArtifactResolutionException: Failure to transfer com.atlassian.jira:jira-rest-java-client-core:pom:3.0.1 from http://maven.atlassian.com/public was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact com.atlassian.jira:jira-rest-java-client-core:pom:3.0.1 from/to central (http://maven.atlassian.com/public): EOFException pom.xml /jira-int line 1 Maven Dependency Problem
Can some one provide me pom and sample client code to create an issue in my JIRA.
You need to add the following dependencies:
<!-- Dependencies for Jira module -->
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-api</artifactId>
<version>${jiraClientVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-core</artifactId>
<version>${jiraClientVersion}</version>
<scope>provided</scope>
</dependency>
where ${jiraClientVersion} is the jira rest java client version.
Also I have added the following repository:
<repository>
<id>atlassian-public</id>
<url>https://m2proxy.atlassian.com/repository/public</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
Then you can use all the libraries the jira rest java client provides.
I am trying to add MS SQL driver dependency in my POM.xml file and the following is the dependency.
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
but I get this exception
Missing artifact com.microsoft.sqlserver:sqljdbc4:jar:4.0
I really don't understand the issue.
UPDATE
Microsoft now provide this artifact in maven central. See #nirmal's answer for further details: https://stackoverflow.com/a/41149866/1570834
ORIGINAL ANSWER
The issue is that Maven can't find this artifact in any of the configured maven repositories.
Unfortunately Microsoft doesn't make this artifact available via any maven repository. You need to download the jar from the Microsoft website, and then manually install it into your local maven repository.
You can do this with the following maven command:
mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar
Then next time you run maven on your POM it will find the artifact.
Microsoft recently open sourced their jdbc driver.
You can now find the driver on maven central:
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
or for java 7:
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre7</version>
</dependency>
I had the similar problem and solved it by doing following.
Download sqljdbc4.jar from the Microsoft website to your local machine.
Right click on Project-->Import-->Maven-->Install or deploy an artifact to a Maven repository as shown below.
* Next-->Fill the following details
Artifact file:
path of the jar you downloaded (Ex: E:\lib\sqljdbc4.jar in my case)
Group Id: com.microsoft.sqlserver
Artifact Id: sqljdbc4
Version: 4.0
Then Refresh/clean the project.
Thank you!
You can also create a project repository. It's useful if more developers are working on the same project, and the library must be included in the project.
First, create a repository structure in your project's lib directory, and then copy the library into it. The library must have following name-format: <artifactId>-<version>.jar
<your_project_dir>/lib/com/microsoft/sqlserver/<artifactId>/<version>/
Create pom file next to the library file, and put following information into it:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.2.0</modelVersion>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.2</version>
</project>
At this point, you should have this directory structure:
<your_project_dir>/lib/com/microsoft/sqlserver/sqljdbc4/4.2/sqljdbc4-4.2.jar
<your_project_dir>/lib/com/microsoft/sqlserver/sqljdbc4/4.2/sqljdbc4-4.2.pom
Go to your project's pom file and add new repository:
<repositories>
<repository>
<id>Project repository</id>
<url>file://${basedir}/lib</url>
</repository>
</repositories>
Finally, add a dependency on the library:
<dependencies>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.2</version>
</dependency>
</dependencies>
Update 2017-03-04
It seems like the library can be obtained from publicly available repository. #see nirmal's and Jacek Grzelaczyk's answers for more details.
Update 2020-11-04
Currently Maven has a convenient target install which allow you to deploy an existing package into a project / file repository without the need of creating POM files manually. It will generate those files for you.
mvn install:install-file \
-Dfile=sqljdbc4.jar \
-DgroupId=com.microsoft.sqlserver \
-DartifactId=sqljdbc4 \
-Dversion=4.2 \
-Dpackaging=jar \
-DlocalRepositoryPath=${your_project_dir}/lib
The above answer only adds the sqljdbc4.jar to the local repository. As a result, when creating the final project jar for distribution, sqljdbc4 will again be missing as was indicated in the comment by #Tony regarding runtime error.
Microsoft (and Oracle and other third party providers) restrict the distribution of their software as per the ENU/EULA. Therefore those software modules do not get added in Maven produced jars for distribution. There are hacks to get around it (such as providing the location of the 3rd party jar file at runtime), but as a developer you must be careful about violating the licensing.
A better approach for jdbc connectors/drivers is to use jTDS, which is compatible to most DBMS's, more reliable, faster (as per benchmarks), and distributed under GNU license. It will make your life much easier to use this than trying to pound the square peg into the round hole following any of the other techniques above.
just add
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>runtime</scope>
</dependency>
For self-containing Maven project I usually installing all external jar dependencies into project's repository. For SQL Server JDBC driver you can do:
download JDBC driver from https://www.microsoft.com/en-us/download/confirmation.aspx?id=11774
create folder local-repo in your Maven project
temporary copy sqljdbc42.jar into local-repo folder
in local-repo folder run mvn deploy:deploy-file -Dfile=sqljdbc42.jar -DartifactId=sqljdbc42 -DgroupId=com.microsoft.sqlserver -DgeneratePom=true -Dpackaging=jar -Dversion=6.0.7507.100 -Durl=file://. to deploy JAR into local repository (stored together with your code in SCM)
sqljdbc42.jar and downloaded files can be deleted
modify your's pom.xml and add reference to project's local repository:
xml
<repositories>
<repository>
<id>parent-local-repository</id>
<name>Parent Local repository</name>
<layout>default</layout>
<url>file://${basedir}/local-repo</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Now you can run your project everywhere without any additional configurations or installations.
If you are having some issue when including dependency for 6.1.0.jre7 from #nirmals answer in https://stackoverflow.com/a/41149866/1570834, in your pom with commons-codec/ azure-keyvault I prefer going with this:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.2.2.jre7</version>
</dependency>
It is not too hard. I have not read the license yet. However I have proven this works. You can copy sqljdbc4 jar file to a network share or local directory. Your build.gradle should look like this :
apply plugin: 'java'
//apply plugin: 'maven'
//apply plugin: 'enhance'
sourceCompatibility = 1.8
version = '1.0'
//library versions
def hibernateVersion='4.3.10.Final'
def microsoftSQLServerJDBCLibVersion='4.0'
def springVersion='2.5.6'
def log4jVersion='1.2.16'
def jbossejbapiVersion='3.0.0.GA'
repositories {
mavenCentral()
maven{url "file://Sharedir/releases"}
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
compile "org.hibernate:hibernate-core:$hibernateVersion"
compile "com.microsoft.sqlserver:sqljdbc4:$microsoftSQLServerJDBCLibVersion"
}
task showMeCache << {
configurations.compile.each { println it }
}
under the sharedir/releases directory, I have directory similar to maven structure which is \sharedir\releases\com\microsoft\sqlserver\sqljdbc4\4.0\sqljdbc4-4.0.jar
good luck.
David Yen
You can use another driver
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.3.1</version>
</dependency>
and in xml
<bean id="idNameDb" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
<property name="url" value="jdbc:jtds:sqlserver://[ip]:1433;DatabaseName=[name]" />
<property name="username" value="user" />
<property name="password" value="password" />
</bean>
The com.microsoft.sqlserver package on Maven now only has version 6.0 as the lowest version JDBC. So you need try another groupId Maven which has JDBC version 4.0.
I recommend this; it works for me. I'm using SQL Server 2012 and Java 8.
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.3.1</version>
</dependency>
And a config properties file like:
jdbc.driverClassName = net.sourceforge.jtds.jdbc.Driver
jdbc.url = jdbc:jtds:sqlserver://localhost:1433;databasename=YourDB;encrypt=true;trustserverCertificate=true
I am trying to learn Maven and to that end I want to create a project in Eclipse 4.3 targetting the GAE (latest version: 1.8.4) and using Maven for building/dependency management. I want to include Resteasy and CDI, but for the time being I have problems with Resteasy.
What have I done:
Followed this guide (without the Jersey part) to setup a Maven/Eclipse/GAE project. I had to change the Java source and target configuration to 1.7 and it worked great.
To include Resteasy:
Added the following dependencies:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.7.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>2.3.7.Final</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>2.3.7.Final</version>
</dependency>
Implemented javax.ws.rs.core.Application.
And the following configuration in web.xml:
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>npara.expenses.server.JaxRsApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
When running the project, using the launch configuration created by Maven, I get the following exception:
java.lang.ClassNotFoundException:
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
The HttpServletDispatcher is located in resteasy-jaxrs-2.3.7.Final.jar, which is correctly placed in WEB-INF/lib. I already have created a similar project using GAE, Resteasy, CDI without Maven (manual JAR management) and this exact configuration and it works perfectly.
Any help appreciated!
Try to use Jersey it is easier to use.
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.9.1</version>
</dependency>
I am learing REST throught java using JBoss RestEasy. To use JAXB api implementation I given the following dependency in pom.xml, {I am using maven project in eclipse}
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.1.GA</version>
</dependency>
But I am getting some set of build errors. But the below is the root cause of the errors I guess,
ArtifactDescriptorException: Failed to read artifact descriptor for javax.xml.stream:stax-api:jar:1.0-2:
ArtifactResolutionException: Failure to transfer javax.xml.stream:stax-api:pom:1.0-2 from
http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval
of central has elapsed or updates are forced.
Original error: Could not transfer artifact javax.xml.stream:stax-api:pom:1.0-2 from/to central (http://repo1.maven.org/maven2): null to http://repo1.maven.org/maven2/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.pom
By the above error I understand that it failed to transfer the stax-api depency file. I added the dependency for that stax-api later. But no use. Still getting the same error.
Is my perception of the above error correct? If so do I have to give the repository info for this file too in pom.xml? Then is it not contradicting the main advantage of Maven usage(auto download of dependency files)?
Please correct me if I were wrong
Below is my complete pom.xml,
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.droidaceapps.services</groupId>
<artifactId>RestServicesProject</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>RestServicesProject Maven Webapp</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>jboss</id>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.1.GA</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>2.3.1.GA</version>
</dependency>
</dependencies>
<build>
<finalName>RestServicesProject</finalName>
</build>
</project>
Thanks
Hurrah...I solved this. I did execute the MVN from command line .. it just worked. Then I went back to eclipse and refreshed the project then all the bugs gone and all dependancies are in place.
seems there is a problem with the m2eclipse plugin (whichi I conculde as root cause of the bug.. :-)
i solved this problem....not using maven.......just by creating a Dynamic web project...with jboss server..with web.xml
and then...go to source > new >other >web service > create a sample restful web serivce
click to update the web.xml......and it support jboss in eclipse