Why Cannot I import the class from hbase.io.hfile package - java

I have a HFile that I am trying to read/deserialize using Java.
Looks like this HFile.reader is very promising but however, I am having a hard time even getting the library imported in Maven.
This is how my POM looks like:
<dependencies>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-common</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
And somehow I don't see that many classes or objects when I tried to import.

This class can be found in the hbase-server artifact, so you need to depend on that one instead of hbase-common and hbase-client:
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-server</artifactId>
<version>1.2.1</version>
</dependency>
But do note that this class is not intended to be used by 3rd parties. It is annotated #InterfaceAudience.Private, which means:
Intended for use only within Hadoop itself.

Related

How to include multiple jar in type from type field in pom dependency?

I have the following pom definition
<dependencies>
<dependency>
<groupId>com.my.stuff</groupId>
<artifactId>my-stuff</artifactId>
<version>${my-stuff.version}</version>
<type>test-jar</type>
</dependency>
I want to use both jar and test-jar , is there a way to do that?
I guess that test-jar is not a type, but a classifier. You probably want something like:
<dependencies>
<dependency>
<groupId>com.my.stuff</groupId>
<artifactId>my-stuff</artifactId>
<version>${my-stuff.version}</version>
<classifier>test-jar</classifier>
</dependency>
<dependency>
<groupId>com.my.stuff</groupId>
<artifactId>my-stuff</artifactId>
<version>${my-stuff.version}</version>
</dependency>
</dependencies>

Where is Lucene's BaseTokenStreamFactoryTestCase in the Maven repository

I am currently writing a Lucene Tokenizer and I want to test my class. For the test, I got inspiration from the Lucene test class TestStandardFactories which is a child class of the testing class BaseTokenStreamTestCase. Accordingly my test class is also a child class of BaseTokenStreamTestCase.
I apply Maven and hence my pom.xml looks like this:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>de.institute.taggedtexttokenizer</groupId>
<artifactId>tagged-text-tokenizer</artifactId>
<version>0.2</version>
<properties>
<lucene-version>7.2.0</lucene-version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.lucene/lucene-test-framework -->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-test-framework</artifactId>
<version>${lucene-version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.lucene/lucene-core -->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>${lucene-version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.lucene/lucene-analyzers-common -->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<version>${lucene-version}</version>
</dependency>
</dependencies>
</project>
I expected the BaseTokenStreamTestCase to be in the lucene-test-framework and hence my test to run properly. However, the compiler complains that it cannot find the class BaseTokenStreamTestCase. A quick look in the lucene-test-framework assured me that this class is not contained in there.
Which Maven dependency do I need to include to have access to this class?
I double checked and lucene-test-framework artifact contains needed class: org.apache.lucene.analysis.BaseTokenStreamTestCase.
One of the possible reasons, why compiler complaints about this class is, because you are using <scope>test</scope>, which means, that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases.
For example, you may put this test into src/main/java place, so it's test dependency couldn't pick it up.

Finding the Caltech101 class and Record in OpenImaj

I am trying this tutorial http://www.openimaj.org/tutorial/classification101.html and this code is failing for me:
GroupedDataset<String, VFSListDataset<Record<FImage>>, Record<FImage>> allData =
Caltech101.getData(ImageUtilities.FIMAGE_READER);
The reason is that Record and Caltech101 are not recognized and can't import them. All the other classes work fine.
Here is my maven dependency:
<dependencies>
<dependency>
<artifactId>image-processing</artifactId>
<groupId>org.openimaj</groupId>
<version>1.3.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
I also tried adding all the other dependencies from their website, http://www.openimaj.org/index.html but with no luck.
If anybody that had expirience with OpenImaj, if they could help that would be great.
You need to add the image-annotation Maven dependency.
<dependency>
<groupId>org.openimaj</groupId>
<artifactId>image-annotation</artifactId>
<version>1.3.1</version>
</dependency>
Note that compile scope is the default scope so you can't omit it.

What dependencies needed for AndroidJUnit4.class

I am creating a test class to test an Android application and I would like to use the AndroidJUnit4 class as runner:
#RunWith(AndroidJUnit4.class)
However I can't figure out what dependencies do I need to add to my Maven project to get it. I tried these:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
</dependency>
and:
<dependency>
<groupId>com.uphyca</groupId>
<artifactId>android-junit4</artifactId>
<version>0.5</version>
</dependency>
The last one seemed the most promising but it only added the following classes:
AndroidJUnit4TestAdapter
AndroidJUnit38ClassRunner
AndroidJUnit3Builder
which is not what I need.
You can either add this directly:
<dependency>
<groupId>com.uphyca</groupId>
<artifactId>android-junit4</artifactId>
<version>0.5</version>
</dependency>
Or if you are just looking for the dependencies, try to look this page:
http://mvnrepository.com/artifact/com.uphyca/android-junit4/0.5

what I need to do to use the ManagedBean library?

Ive been using anotation for my beans (I havent used them before) and I found out I have to include some dependencies and so on, like this:
<!--JSF API-->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.2</version>
</dependency>
<!-- PrimeFaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.3</version>
</dependency>
<!-- JSF -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<!-- Javax Servlet. This needs to be included for runtime only! -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
and well.. the problem is that the I keep getting the error of
The import javax.faces cannot be resolved
Every time I need to use the managed bean... I am using Maven and I am supposed to have downloaded all things I need, I also tried other POM and in that project I can use anotations, so, I guess is a misconfiguratino of the POM? I didnt do anything special to ecplise, except enable the maven clean, maven eclipse, and maven eclipse skip test
I really checked other answers, like these:
The import javax.servlet can't be resolved
How do I import the javax.servlet API in my Eclipse project?
but nothing, any idea what could be wrong??
You should not import the servlet API but implementation of the API, for example the servlet container implementation you want on which you want to run your project : Tomcat, JBoss, Websphere, Glassfish....
E.g. for tomcat :
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>7.0.30</version>
<scope>provided</scope>
</dependency>
Thanks for the answer, I checked that using Maven its a little bit different and in the built path you have to specify the path for your maven repository, so, it will incluide all libraries directly or you can copy and past them into your project

Categories