0

please forgive me if this is a silly question but i am trying to compile some java code that I found at http://thisdataguy.com/2014/02/07/how-to-build-a-full-flume-interceptor-by-a-non-java-developer/

I am very new to java programming and when I run the code I get the error:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - org.apache.flume:eventTweaker:jar:1.0
[INFO]    task-segment: [clean, package]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting file set: /home/kwincott/jars/tweaker/target (included: [**], excluded:    [])
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/kwincott/jars/tweaker/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1 source file to /home/kwincott/jars/tweaker/target/classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

/home/kwincott/jars/tweaker/src/main/java/com/example/flume/interceptors   /eventTweaker.java:[18,3] annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
@Override

/home/kwincott/jars/tweaker/src/main/java/com/example/flume/interceptors/eventTweaker.java:[24,7] generics are not supported in -source 1.3
(use -source 5 or higher to enable generics)
Map<String, String> headers = event.getHeaders();

/home/kwincott/jars/tweaker/src/main/java/com/example/flume/interceptors/eventTweaker.java:[46,20] for-each loops are not supported in -source 1.3
(use -source 5 or higher to enable for-each loops)
for (Event event:events) {


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Aug 20 16:26:17 BST 2014
[INFO] Final Memory: 19M/303M
[INFO] ------------------------------------------------------------------------
5
  • 1
    annotations are not supported in -source 1.3 and generics are not supported in -source 1.3 and for-each loops are not supported in -source 1.3. There's your problem, these are not supported. use -source 5 or higher Commented Aug 20, 2014 at 15:35
  • how would I go about that? like I said in the original post I am very new to java as a programming language. Commented Aug 20, 2014 at 15:36
  • Maybe you are using an outdated version of JDK or maven? Commented Aug 20, 2014 at 15:42
  • Download and try with newer java version jdk6, 7 or 8 and Maven 2.x or 3.x. Commented Aug 20, 2014 at 15:43
  • Please use Maven 3.X at least and not Maven 2.X anymore. Commented Aug 20, 2014 at 16:14

2 Answers 2

0

Apparently, Maven's compiler plugin cares nothing for what Java version you actually use. The error message is prompting you to set some configuration in your pom.xml:

Sign up to request clarification or add additional context in comments.

Comments

-3

The build failure report pretty much says everything:

[18,3] annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
@Override

[24,7] generics are not supported in -source 1.3
(use -source 5 or higher to enable generics)
Map<String, String> headers = event.getHeaders();

[46,20] for-each loops are not supported in -source 1.3
(use -source 5 or higher to enable for-each loops)
for (Event event:events) {

(use -source 5 or higher to enable for-each loops)

You are probably using an outdated version of JDK (6 or up) and/or Maven (3.x or up). Update to the newest JDK and Maven version and the error should be gone.

But, as it says in the INFO section at the end of your build report, for more information, run Maven with the -e switch. This will help you for debugging issues in the future.

3 Comments

Im using java6 (open-jdk6) and maven 2
@KevinWincott Sorry, 3 or up, not 2 or up.
Update to Maven 3 as soon as possible...cause Maven 2 is EoL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.