NeilMadden / apisecurityinaction

Source code that accompanies the book API Security in Action
MIT License
147 stars 97 forks source link

Chapter 2 - Getting Compilation Error for mvn clean compile exec:java #7

Closed santikris2003 closed 4 years ago

santikris2003 commented 4 years ago

I had setup maven with step wise instruction as in Chapter 2 but when I run Maven build or mvn clean compile exec:java getting compilation error as below:

SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/Applications/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [file:/Applications/Eclipse.app/Contents/Eclipse/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory] SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/Applications/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [file:/Applications/Eclipse.app/Contents/Eclipse/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory] [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] natter-api [jar] [INFO] natter-api [pom] [INFO] [INFO] -----------< com.manning.api-security-in-action:natter-api >------------ [INFO] Building natter-api 1.0.0-SNAPSHOT [1/2] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ natter-api --- [INFO] Deleting /Users/testuser/Desktop/apisecurityinaction/natter-api/target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ natter-api --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /Users/testuser/Desktop/apisecurityinaction/natter-api/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ natter-api --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 2 source files to /Users/testuser/Desktop/apisecurityinaction/natter-api/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /Users/testuser/Desktop/apisecurityinaction/natter-api/src/main/java/com/manning/apisecurityinaction/Main.java:[21,16] class, interface, or enum expected [ERROR] /Users/testuser/Desktop/apisecurityinaction/natter-api/src/main/java/com/manning/apisecurityinaction/Main.java:[24,11] expected [ERROR] /Users/testuser/Desktop/apisecurityinaction/natter-api/src/main/java/com/manning/apisecurityinaction/Main.java:[25,16] expected [ERROR] /Users/testuser/Desktop/apisecurityinaction/natter-api/src/main/java/com/manning/apisecurityinaction/Main.java:[25,33] expected [ERROR] /Users/testuser/Desktop/apisecurityinaction/natter-api/src/main/java/com/manning/apisecurityinaction/Main.java:[27,1] class, interface, or enum expected [INFO] 5 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] natter-api 1.0.0-SNAPSHOT .......................... FAILURE [ 0.841 s] [INFO] natter-api 1.0-SNAPSHOT ............................ SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.902 s [INFO] Finished at: 2020-08-23T21:04:43+05:30 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project natter-api: Compilation failure: Compilation failure: [ERROR] /Users/testuser/Desktop/apisecurityinaction/natter-api/src/main/java/com/manning/apisecurityinaction/Main.java:[21,16] class, interface, or enum expected [ERROR] /Users/testuser/Desktop/apisecurityinaction/natter-api/src/main/java/com/manning/apisecurityinaction/Main.java:[24,11] expected [ERROR] /Users/testuser/Desktop/apisecurityinaction/natter-api/src/main/java/com/manning/apisecurityinaction/Main.java:[25,16] expected [ERROR] /Users/testuser/Desktop/apisecurityinaction/natter-api/src/main/java/com/manning/apisecurityinaction/Main.java:[25,33] expected [ERROR] /Users/testuser/Desktop/apisecurityinaction/natter-api/src/main/java/com/manning/apisecurityinaction/Main.java:[27,1] class, interface, or enum expected [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

santikris2003 commented 4 years ago

I have also attached MainandSpaceController_java_files.zip Main.java and SpaceController.java which I have setup in my Eclipse IDE

NeilMadden commented 4 years ago

It looks like you've got an extra close brace between the end of the main method and the start of the createTables method. If you delete the extra one then it should compile.