Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # dev >> using test-jars in hbase maven project

Copy link to this message
Re: using test-jars in hbase maven project
This is a known issue in maven that we have to do a more advanced build
phase (test-compile) to run a simpler one. The main reason behind this is
that maven isn't smart enough at the moment to recognize when it needs to
do more work for another, dependent, module. For instance, it needs the
hadoop-compat.jar since it is a dependent project but it can't get it
because it doesn't get run in the correct phase.

This is a known issue with maven and there are comments in the pom (or at
least there were, when I moved the poms) to the effect that there are filed
maven issues and its a known bug. It seemed a minor overhead to workaround
the bug by ordering your tasks correctly in maven such that things build
correctly. Note that you can run maven with the -o option to run offline
and any previously installed jars will be used and any changes your made
will overwrite only the necessary jars.

There has also been some discussion around moving the test sources around
for certain classes, such that they are correctly inheritable. On one hand,
this solves the problem, but is a 'dirty' way to enable the sources to be
accessible. In fact, we discussed this option with the hbase-common module (

If I recall correctly, we ended up going with the idea of moving the
test-utilites to a src/main directory, but leaving the actual tests in the
test directory. Even better, would be creating an hbase-test-util class
that has the utilities in the src/main and is usable by all dependent
projects (though this could just as easily stay in hbase-common).

The problem with building the jar at generate-test-sources (or -resources)
is that this is actually before the compilation step (test-compile),
inherently breaking the logical ordering of these things.

All that said, any ideas to make this better (in a comprehensive solution)
would be great!

Jesse Yates
On Wed, Aug 1, 2012 at 12:33 PM, Alex Baranau <[EMAIL PROTECTED]>wrote:

> Hello,
> I've been working on https://issues.apache.org/jira/browse/HBASE-6411.
> There's a patch almost ready for commit (I guess). But we faced the
> following problem. Would be great if someone can share his ideas. Thank
> you!
> Zhihong Ted Yu<
> https://issues.apache.org/jira/secure/ViewProfile.jspa?name=zhihyu%40ebaysf.com
> >
> added
> a comment - 01/Aug/12 16:43
> For findbugs:
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-remote-resources-plugin:1.1:process
> (default) on project hbase-hadoop1-compat: Failed to resolve
> dependencies for one or more projects in the reactor. Reason: Missing:
> [ERROR] ----------
> [ERROR] 1)
> org.apache.hbase:hbase-hadoop-compat:test-jar:tests:0.95-SNAPSHOT
> [ERROR] Try downloading the file manually from the project website.
> [ERROR] Then, install it using the command:
> [ERROR] mvn install:install-file -DgroupId=org.apache.hbase
> -DartifactId=hbase-hadoop-compat -Dversion=0.95-SNAPSHOT
> -Dclassifier=tests -Dpackaging=test-jar -Dfile=/path/to/file
> [ERROR] Alternatively, if you host your own repository you can deploy
> the file there:
> [ERROR] mvn deploy:deploy-file -DgroupId=org.apache.hbase
> -DartifactId=hbase-hadoop-compat -Dversion=0.95-SNAPSHOT
> -Dclassifier=tests -Dpackaging=test-jar -Dfile=/path/to/file
> -Durl=[url] -DrepositoryId=[id]
> [ERROR] Path to dependency:
> [ERROR] 1) org.apache.hbase:hbase-hadoop1-compat:jar:0.95-SNAPSHOT
> [ERROR] 2)
> org.apache.hbase:hbase-hadoop-compat:test-jar:tests:0.95-SNAPSHOT
> [ERROR] ----------
> [ERROR] 1 required artifact is missing.
> Alex Baranau:
> Heh,
> Take a look at http://jira.codehaus.org/browse/MRRESOURCES-53. I guess we
> are facing this problem. I tried to fix by moving remote plugin from
> execution phase as it was suggested by adding [1] to parent pom. Though it
> managed to compile hadoop1-compat, hbase-server compilation failed with