Skip to content

Error on build #2

@Aetherus

Description

@Aetherus

When executing mvn build or mvn package, the following error occurs:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.044s
[INFO] Finished at: Mon Dec 29 10:10:43 CST 2014
[INFO] Final Memory: 9M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project gogotester-java: Compilation failure: Compilation failure:
[ERROR] /home/zhoumh/Downloads/gogotester-java-master/src/main/java/com/company/util/ConcurrentLinkedBlockingQueue.java:[20,42] error: generics are not supported in -source 1.3
[ERROR] 
[ERROR] (use -source 5 or higher to enable generics)
[ERROR] /home/zhoumh/Downloads/gogotester-java-master/src/main/java/com/company/labor/Labor.java:[31,29] error: generics are not supported in -source 1.3
[ERROR] 
[ERROR] (use -source 5 or higher to enable generics)
[ERROR] /home/zhoumh/Downloads/gogotester-java-master/src/main/java/com/company/util/PropertiesUtil.java:[15,33] error: generics are not supported in -source 1.3
[ERROR] 
[ERROR] (use -source 5 or higher to enable generics)
[ERROR] /home/zhoumh/Downloads/gogotester-java-master/src/main/java/com/company/util/HttpConnect.java:[20,4] error: generics are not supported in -source 1.3
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

I think it's because maven's java compiler defaults to 1.3, and that version doesn't support generic types.

Adding the following lines into pom.xml should help:

<build>
    ...
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
              <source>1.7</source>
              <target>1.7</target>
            </configuration>
        </plugin>
        ...
    </plugins>
    ...
</build>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions