Maven BUILD FAILURE when installing Mahout on Ubuntu

北慕城南 提交于 2019-12-24 22:32:11

问题


I am trying to build mahout in Ubuntu 12.04, but on a virtual machine running on a Windows 7 host machine. Maven does not seem to like this, and I don't really understand how to fix the problem. This is the result of a good long period of build tests:

Results :

Failed tests:

SearchSanityTest.testRemoval:166->Assert.assertEquals:494->Assert.failNotEquals:743->Assert.fail:88 Previous second neighbor should be first expected:<0.0> but was:<15.74860724515773>

Tests run: 834, Failures: 1, Errors: 0, Skipped: 0


[INFO] Reactor Summary:

[INFO] 

[INFO] Apache Mahout ..................................... SUCCESS [3.106s]

[INFO] Mahout Build Tools ................................ SUCCESS [2.997s]

[INFO] Mahout Math ....................................... SUCCESS [4:59.221s]

[INFO] Mahout Core ....................................... FAILURE [48:17.299s]

[INFO] Mahout Integration ................................ SKIPPED

[INFO] Mahout Examples ................................... SKIPPED

[INFO] Mahout Release Package ............................ SKIPPED

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

Any ideas anyone? Is there anything I can do about this?

I have hadoop installed, I believe I set it up right by configuring SSH and starting/stopping a namenode just to make sure it worked. I have JDK1.7.0_25

Update:

well, I just tried to build it using " sudo " and it got a little further but still failed.

Results :

Failed tests: 
  SequenceFilesFromMailArchivesTest.testSequential:106->Assert.assertEquals:144->Assert.assertEquals:115 expected:<TEST/subdir/[mail-messages].gz/user@example.com> but was:    <TEST/subdir/[subsubdir/mail-messages-2].gz/user@example.com>

Tests run: 106, Failures: 1, Errors: 0, Skipped: 0

I feel I must be doing something wrong, since lots of people must install mahout via maven every day. Any ideas? Or still just //comment out the tests that fail?


回答1:


if you just want to build mahout jar files , then you can skipTest. try this command instead:

sudo mvn -DskipTests install -e

this work for me :)




回答2:


You're building from source and there is one test that is failing.

You can either fix the broken test yourself or hope that it will be fixed soon (Update from SVN once in a while).

If you can't wait and you're confident that things will work 'more or less' your way, you can just delete the broken test so that you'll be able to build... There might be some side effects to this approach...




回答3:


I've encountered this problem just now. I found that you can modify the method SequenceFilesFromMailArchivesTest.testSequential as following to solve the problem:

@Test
public void testSequential() throws Exception {

File outputDir = this.getTestTempDir("mail-archives-out");

String[] args = {
  "--input", inputDir.getAbsolutePath(),
  "--output", outputDir.getAbsolutePath(),
  "--charset", "UTF-8",
  "--keyPrefix", "TEST",
  "--method", "sequential",
  "--body", "--subject", "--separator", ""
};

// run the application's main method
SequenceFilesFromMailArchives.main(args);

// app should create a single SequenceFile named "chunk-0" in the output dir
File expectedChunkFile = new File(outputDir, "chunk-0");
String expectedChunkPath = expectedChunkFile.getAbsolutePath();
Assert.assertTrue("Expected chunk file " + expectedChunkPath + " not found!", expectedChunkFile.isFile());

Configuration conf = new Configuration();
SequenceFileIterator<Text, Text> iterator = new SequenceFileIterator<Text, Text>(new Path(expectedChunkPath), true, conf);
Assert.assertTrue("First key/value pair not found!", iterator.hasNext());
Pair<Text, Text> record ;//= iterator.next();
/*
File parentFile = new File(new File(new File("TEST"), "subdir"), "mail-messages.gz");
Assert.assertEquals(new File(parentFile, testVars[0][0]).toString(), record.getFirst().toString());
Assert.assertEquals(testVars[0][1] + testVars[0][2], record.getSecond().toString());

Assert.assertTrue("Second key/value pair not found!", iterator.hasNext());

record = iterator.next();
Assert.assertEquals(new File(parentFile, testVars[1][0]).toString(), record.getFirst().toString());
Assert.assertEquals(testVars[1][1] + testVars[1][2], record.getSecond().toString());
*/
record = iterator.next();
File parentFileSubSubDir = new File(new File(new File(new File("TEST"), "subdir"), "subsubdir"), "mail-messages-2.gz");
Assert.assertEquals(new File(parentFileSubSubDir, testVars[0][0]).toString(), record.getFirst().toString());
Assert.assertEquals(testVars[0][1] + testVars[0][2], record.getSecond().toString());

Assert.assertTrue("Second key/value pair not found!", iterator.hasNext());
record = iterator.next();
Assert.assertEquals(new File(parentFileSubSubDir, testVars[1][0]).toString(), record.getFirst().toString());
Assert.assertEquals(testVars[1][1] + testVars[1][2], record.getSecond().toString());

/////////Modified By ZhouShuang/////////////
record = iterator.next();
File parentFile = new File(new File(new File("TEST"), "subdir"), "mail-messages.gz");
Assert.assertEquals(new File(parentFile, testVars[0][0]).toString(), record.getFirst().toString());
Assert.assertEquals(testVars[0][1] + testVars[0][2], record.getSecond().toString());

Assert.assertTrue("Second key/value pair not found!", iterator.hasNext());

record = iterator.next();
Assert.assertEquals(new File(parentFile, testVars[1][0]).toString(), record.getFirst().toString());
Assert.assertEquals(testVars[1][1] + testVars[1][2], record.getSecond().toString());
//////////Modified By ZhouShuang////////////

Assert.assertFalse("Only two key/value pairs expected!", iterator.hasNext());
}

The problem happened just because the Files in File[] returned by listFiles() are sorted randomly. I've made a test program to check it. It turns out the following sequence: /home/alain/mytests/subsubdir /home/alain/mytests/mail-messages.gz and according to the accept() method in PrefixAdditionFilter class, it will recursively put the files in a dirctory into a SequenceFile. So when we use iterator.next to get the key-value in the SequenceFile,we will first get subsubdir/mail-messages-2.gz and then mail-messages.gz. But in the original testSequential() function, it first checks the mail-messages.gz and then subsubdir/mail-messages-2.gz. So the order is reversed. Just modified the order,and it will be all right. Caution, there are two SequenceFilesFromMailArchivesTest.java files, one is in distribution package and the other in integration package. We should modify the later. I've made a mistake :)



来源:https://stackoverflow.com/questions/17351177/maven-build-failure-when-installing-mahout-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!