Maven dependency for Tableau Data Extractor API? - java

I am trying to create a maven dependency to use the Tableau Data Extractor API. I have followed the suggestions here https://community.tableau.com/thread/172839 as I cant find any official documentation
I download and extract the API here https://www.tableau.com/data-extract-api.
and follow the suggestions
The above post suggests running the following commands
mvn install:install-file -Dfile=jna.jar -DgroupId=com.sun.jna -DartifactId=jna -Dversion=3.5.1 -Dpackaging=jar
mvn install:install-file -Dfile=tableauextract.jar -DgroupId=com.tableausoftware -DartifactId=tableau-extract -Dversion=9.1.0 -Dpackaging=jar
mvn install:install-file -Dfile=tableaucommon.jar -DgroupId=com.tableausoftware -DartifactId=tableau-common -Dversion=9.1.0 -Dpackaging=jar
mvn install:install-file -Dfile=tableauserver.jar -DgroupId=com.tableausoftware -DartifactId=tableau-server -Dversion=9.1.0 -Dpackaging=jar
Then add dependencies to pom.xml:
<dependency>
<groupId>com.tableausoftware</groupId>
<artifactId>tableau-extract</artifactId>
<version>9.1.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.tableausoftware</groupId>
<artifactId>tableau-common</artifactId>
<version>9.1.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.tableausoftware</groupId>
<artifactId>tableau-server</artifactId>
<version>9.1.0</version>
<type>jar</type>
</dependency>
I am not very familiar with maven and probably wrong, but i think the API has been updated and now contains only these 2 jars instead of the 4 above
dataextract.jar
jna.jar
I dont see any reference to the tableaucommon or tableauserver jars. Does anyone know if they are still needed, where can I get them?

Related

Import JAR files to spring using maven

I tried to import some JAR files to my maven spring project using maven install plugin.
I placed the JARs in a lib folder in my base directory (where the POM.XML file is) and installed them one by one manually by running mvn install.
My xml looks like:
EDIT:
<dependency>
<groupId>com.keydoxWeb</groupId>
<artifactId>keydox</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>myPath\codecs.jar</systemPath>
</dependency>
<!-- and so on.. -->
Still telling me this error:
"Should use a variable instead of a hard coded path"
To import jars to your local repo, you generally would not have to or want to edit a pom.xml file. Rather there are shell commands that you can use to import the jars to your local maven repo (typically located at ~/.m2). Said commands are described here -- looks like this:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
Once you do this, you'll also have to bring the dependencies into your projects pom.xml as explicit dependencies. That will look like this:
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.0</version>
</dependency>
...
</dependencies>
Hope it helps!
Usually you do not have to import jars manually - they are installed by maven into local repository. And eclipse needs to know where this maven repository is. You may regenerate eclipse project files via
mvn eclipse:eclipse
(or switch to IntelliJ IDEA which opens maven projects natively)

Impossible to add my jar with scope in my project maven

Sorry for the spelling, I'm french
I try to install with scope a jar for oracle in my project
Here my pom.xml
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
<scope>system</scope>
<systemPath>C:/Users/bin/Desktop/dossier_access/instantclient_12_1/ojdbc7.jar</systemPath>
</dependency>
The maven compile didn't function
I did after (it works)
mvn -X install:install-file -Dfile=C:/Users/bin/Desktop/dossier_access/instantclient_12_1/ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.2 -Dpackaging=jar -DpomFile=C:/Users/Documents/Projets/version7/integration-archetype/batch/packaging/integration-archetype-batch/pom.xml
but mvn install gives :
[WARNING] The POM for oracle.jdbc:ojdbc7:jar:12.1.0.2 is missing, no dependency information available
[WARNING] The POM for oracle.jdbc:ucp:jar:12.1.0.2 is missing, no dependency information available
BUILD FAILURE
Thank you for your responses,
i'm beginner with Maven and I have already see on the other posts...
What i usually do is first install jdbc driver in local repository so it is available for all apps in local machine.
Then just use regular dependency tag to include it in you pom file.
Look at this quick tutorial:
http://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/
After installing a 3rd party into your local repo (that is what you did with mvn install:install-file) you can reference it the following way:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
And no path information is required anymore.

I am working in camel (Servicemix 5.4.0) i am getting below error message for sql in pom

I am working in camel (Servicemix 5.4.0) i am getting below error message while compiling project using mvn install
com.microsoft.sqlserver:sqljdbc4:jar:4.0: Failure to find
com.microsoft.sqlserver:sqljdbc:jar:4.0.2206.100 in https://repo.maven.apache.or
g/maven2 was cached in the local repository, resolution will not be reattempted
until the update interval of central has elapsed or updates are forced
I think it might because of pom.xml dependency part.
I have given following dependency in pom.xml
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>runtime</scope>
</dependency>
Please Help me out
This driver is not in Maven standard repository.
You could download it, and add to you local repository with:
mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar
Download link for the driver:
http://www.microsoft.com/en-us/download/details.aspx?id=11774

How do I fix maven exec:java which is mangling jar file names?

I'm developing an app using JOGL on Windows. I've been using Eclipse thus far but I have started writing a corresponding Maven POM file so I can automatic the build and packaging steps.
JOGL is not actively maintained in Maven so I have written a small script that imports the jars via install:install-file into my local repository :
set JOGL_VER=2.0
set JOGL_HOME=./jogl
set JOGL_LIB=%JOGL_HOME%/jar
set MVN_INSTALL=call mvn install:install-file
%MVN_INSTALL% -DgroupId=org.jogamp.gluegen -Dfile=%JOGL_LIB%/gluegen-rt-natives-windows-i586.jar \
-DartifactId=gluegen-rt-natives-windows-i586 -Dversion=%JOGL_VER% -Dpackaging=jar
%MVN_INSTALL% -DgroupId=org.jogamp.gluegen -Dfile=%JOGL_LIB%/gluegen.jar \
-DartifactId=gluegen -Dversion=%JOGL_VER% -Dpackaging=jar
%MVN_INSTALL% -DgroupId=org.jogamp.jogl -Dfile=%JOGL_LIB%/jogl-all-natives-windows-i586.jar \
-DartifactId=jogl-all-natives-windows-i586 -Dversion=%JOGL_VER% -Dpackaging=jar
%MVN_INSTALL% -DgroupId=org.jogamp.jogl -Dfile=%JOGL_LIB%/jogl-all.jar
-DartifactId=jogl-all -Dversion=%JOGL_VER% -Dpackaging=jar
This results in the following files in my repo
.m2\repository\org\jogamp\gluegen\gluegen\2.0\gluegen-2.0.jar
.m2\repository\org\jogamp\gluegen\gluegen\2.0\gluegen-2.0.pom
.m2\repository\org\jogamp\gluegen\gluegen-rt-natives-windows-i586\2.0\gluegen-rt-natives-windows-i586-2.0.jar
.m2\repository\org\jogamp\gluegen\gluegen-rt-natives-windows-i586\2.0\gluegen-rt-natives-windows-i586-2.0.pom
.m2\repository\org\jogamp\jogl\jogl-all\2.0\jogl-all-2.0.jar
.m2\repository\org\jogamp\jogl\jogl-all\2.0\jogl-all-2.0.pom
.m2\repository\org\jogamp\jogl\jogl-all-natives-windows-i586\2.0\jogl-all-natives-windows-i586-2.0.jar
.m2\repository\org\jogamp\jogl\jogl-all-natives-windows-i586\2.0\jogl-all-natives-windows-i586-2.0.pom
Note that since I specified 2.0, the files get suffixed with 2.0, e.g. gluegen-rt-natives-windows-i586-2.0.jar.
But now I want to use the exec:java command to run the app after a build, to ensure it functions i.e.
mvn exec:java
So I add the exec-maven-plugin to my pom.xml
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>com.testapp.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
And I also add the dependencies to JOGL. Not that the native binaries are scoped runtime since I don't need them at compile time:
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-natives-windows-i586</artifactId>
<version>2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-natives-windows-i586</artifactId>
<version>2.0</version>
<scope>runtime</scope>
</dependency>
But when I run this, I get the following error
Catched FileNotFoundException: C:\Users\xxx\.m2\repository\org\jogamp\gluegen\gluegen\2.0\gluegen-2.0-natives-windows-i586.jar (
The system cannot find the file specified), while TempJarCache.bootstrapNativeLib() of jar:file:/C:/Users/xxx/.m2/repository/org
/jogamp/gluegen/gluegen/2.0/gluegen-2.0-natives-windows-i586.jar!/ (file:/C:/Users/xxx/.m2/repository/org/jogamp/gluegen/gluegen
/2.0/ + gluegen-2.0-natives-windows-i586.jar)
[WARNING]
The issue is therefore straightforward. I installed the jars via install:install-file and the version 2.0 was appended after the artifact id e.g. gluegen-rt-natives-windows-i586-2.0.jar, but the exec:java expects the jar to be called gluegen-2.0-natives-windows-i586.jar.
Since the project builds I must assume the compile phase is correctly looking for the jar files using the expected file name, but exec is not.
Why is it dumping the version number in the middle of the artifact id and how do I make it work properly? The artifact id is named according to convention so I don't understand why it would be split like this.
Exec:java has nothing to do with your problem.
JOGL itself has some sort of complex internal mechanism for managing native code via JNI, and that mechanism makes assumptions about file names which are incompatible with the Maven rules for naming files in the repository.
You're going to have to use the maven-assembly-plugin to copy the dependencies to a tree that has the names and shapes required by JOGL and execute from there, or find a way to reconfigure JOGL to tolerate Maven naming conventions.

mvn jetty plugin not working in offline (non internet) mode , however compiles successfully

mvn jetty:run is not working in offline mode showing exception, If connected to internet runs successfully
Take a look at your pom.xml and see if there are any dependencies downloaded from mvn repository.
If you have local JAR files, you won't need to download them using mvn build.
For example:
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/java/com/api/core/jars/gson-2.2.2.jar</systemPath>
</dependency>
Above dependency looks for a local JAR and therefore not online.
But:
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
Downloads the commons-lang jar from mvn repository.
Therefore internet connection is required when you run this.
Therefore. 1st make sure you have no dependencies that require downloading.
Then, use:
mvn jetty:run -o
To run in offline mode.

Categories