Errata

Maven: The Definitive Guide

Errata for Maven: The Definitive Guide

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
1
Example 4-5. simple-weather's Main class (is the exact location)

Page number is wrong. I cannot find page numbers online.

4.6. Simple Weather Source Code (is the section)

Example 4-5. simple-weather's Main class (is the exact location)

try {
zipcode = args[0]); <----- the error is the ')' at end
} catch( Exception e ) {}

Note from the Author or Editor:
Correct, remove the extra ) at the end of this code sample.

Anonymous  Nov 17, 2008 
4.1
lasp paragraph

the link http://books.sonatype.com/maven-book/examples-1.0 is broken

Note from the Author or Editor:
Fixed the URL

Anonymous  Nov 27, 2008 
4.5
Example 4.3

I am reading this book using Safari online so I cannot provide a page number, so I provided the section heading.

"mvn install" for the simple-weather program failed. Compile failed "generics are not supported in -source 1.3". I read ahead in section 10 and found I needed to modify the pom.xml to add new source and target attributes for the compiler plugin. Problem corrected.


"mvn install" for the simple-weather program failed, org.apache.commons.io package was missing. A dependency was forgotten - the WeatherFormatterTest file depends on commons-io. I added it to the POM and "mvn install" worked.

Note from the Author or Editor:
The POM in Example 4.1 shows this source and target configuration for the compiler plugin, but we didn't mention that you need to add this configuration to the POM.

Right before Example 4.1 add the following sentence:

"The POM shown in Example 4.1 also contains configuration for the Maven Compiler plugin which sets the source and target Java versions to 1.5. This configuration is contained in the build element, and it necessary because the example project uses Java 5 language features."

Anonymous  Oct 27, 2008 
4.6. Simple Weather Source Code
Example 4-5. simple-weather's Main class

It seems like there's either a problem with technical proofreading of this book or the Safari version is outdated. I've found 3 mistakes in less than 2 hours and I'm not even at the half of the book yet.

Line 17-19 in source code for Main class in the example reads

try {
zipcode = args[0]);
} catch( Exception e ) {}

where it should have been

try {
zipcode = args[0];
} catch( Exception e ) {}

There's an extra closing parens before semicolon.

Another one is the line 33 reads

InputStream dataIn = new YahooRetriever().retrieve( zip );

it should have been

InputStream dataIn = new YahooRetriever().retrieve( Integer.parseInt(zip) );

Note from the Author or Editor:
In example 4.6, change:

public InputStream retrieve(int zipcode) throws Exception {


to:

public InputStream retrieve(String zipcode) throws Exception {

Anonymous  Nov 29, 2008 
4.9. Writing Unit Tests
Example 4-11. simple-weather's YahooParserTest unit test

first line reads

package org.sonatype.mavenbook.weather.yahoo;

where it should have been

package org.sonatype.mavenbook.weather;

Code does not compile

Note from the Author or Editor:
Yes, examples 4-11 and 4-12 should both begin with

package org.sonatype.mavenbook.weather;

Anonymous  Nov 29, 2008 
4.9. Writing Unit Tests
Example 4-12. simple-weather's WeatherFormatterTest unit test

first line reads

package org.sonatype.mavenbook.weather.yahoo;

where it should have been

package org.sonatype.mavenbook.weather;

Code does not compile

Note from the Author or Editor:
Examples 4-11 and 4-12 should begin with:

package org.sonatype.mavenbook.weather;

Anonymous  Nov 29, 2008 
5.4
Example 5-2

Example reads

<project>
[...]
<build>
<finalName>simple-webapp</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
</plugins>
</plugins>
</build>
[...]
</project>

Where it should have been

<project>
[...]
<build>
<finalName>simple-webapp</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
</plugin> <--- This should have been singular
</plugins>
</build>
[...]
</project>

Note from the Author or Editor:
Yes, this is confirmed. Please update the example as the reader has noted.

Anonymous  Nov 29, 2008 
Printed
Page 32
resources:resources (at bottom of page)


Should be "...is bound to the process-resources phase."

scottd_oreilly  Sep 07, 2009  Sep 01, 2009
Printed
Page 34
resources:testResources (at top of page)


Should read "...is bound to the process-test-resources phase."

Anonymous  Sep 07, 2009  Sep 01, 2009
Printed
Page 66
2nd paragraph

I think there is an error on page 66. Running the following command I received an error:
?Exception in thread "main" java.lang.NoClassDefFoundError: org/sonatype/mavenbook/weather/Main?.

The command in the book is: java ?cp simple-weather-1.0-jar-with-dependencies.jar org.sonatype.mavenbook.weather.Main 10002

Running the following command works:
java -cp mavenbook-examples-1-SNAPSHOT-jar-with-dependencies.jar org.sonatype.mavenbook.weather.Main 10002

Note from the Author or Editor:
Right, the command line is consistent with the book but not consistent with the downloaded examples. I've updated the downloaded examples, there is no need to update the book.

Anonymous  Nov 10, 2008 
Printed
Page 206-208
External Profiles, Settings Profiles

There is an error with the profiles.xml and settings.xml examination.

The schema for External Profiles (http://maven.apache.org/xsd/profiles-1.0.0.xsd) and Settings (http://maven.apache.org/xsd/settings-1.0.0.xsd) does not have the ability to specify a build element (in profiles) or plugin (in settings).

According to the schema these values are not permitted. I attempted to default the compiler on my installation (maven 2.0.9) to use the eclipse compiler plugin and it failed to parse the documents on the invalid elements.

Note from the Author or Editor:
Yes, this is a serious technical mistake: Remove sections 11.4 and 11.5

Anonymous  Oct 31, 2008 
Printed
Page 210
Example 11-9


Add <activation> and </activation> to code example where noted here.

<settings>
<profiles>
<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<environment.type>dev</environment.type>
</properties>
</profile>
</profiles>
</settings>

Anonymous  Sep 07, 2009  Sep 01, 2009
Printed
Page 210
Example 11-10


Change

<database.driverClassName>com.mysql.jdbc.Driver</driverClassName>

to

<database.driverClassName>com.mysql.jdbc.Driver</database.driverClassName>

There are two instances in the code to change.

Anonymous  Sep 07, 2009  Sep 01, 2009
Printed
Page 268
Example 13-4


This is how the build part of the code should read:

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

Anonymous  Sep 07, 2009  Sep 01, 2009
1743
Section 17.4.3, last paragraph:

Note to O'Reilly: this form needs to change; online versions of the book do not have page numbers.

Should "mvn echo:blah" be "mvn blah:echo"?

Note from the Author or Editor:
that's right it should be blah:echo instead of echo:blah

Anonymous  Nov 03, 2008