The issue with the assignment prompt is that we are told to follow the Dropwizard Hello World instructions for running the gameauth.zip application.
Begin by importing the gameauth.zip file into Eclipse as a new Maven project. If you have not already practiced using Maven, be sure to follow the instructions in the Dropwizard Hello World Tutorial.SNHU CS0230 Module Four
The problem with the instructions is that it fails to mention that the gameauth.zip application only works on Java 8 as noted on howtodoinjava.com and on dropwizard.com.
You will need Java 8 to run the examples given in this code which are developed using dropwizard version 1.0.0.https://howtodoinjava.com/dropwizard/tutorial-and-hello-world-example/
When you try to build the application, you will get a build error.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.0-M1:jar (attach-javadocs) on project gameauth: Execution attach-javadocs of goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.0-M1:jar failed: Cannot invoke "org.apache.commons.lang3.JavaVersion.atLeast(org.apache.commons.lang3.JavaVersion)" because "org.apache.commons.lang3.SystemUtils.JAVA_SPECIFICATION_VERSION_AS_ENUM" is null -> [Help 1]
If you Google the issue, you will land on many Stack Overflow discussions suggesting that you surpass the error by editing the POM file. But if you do suppress the error, you will get a NoClassDefFoundError
.
So, What should you do?
You have two options. The easy option is to edit your POM file and the tedious option is to change your version of Java to Java 8.
Towards the end of the POM file, add a source tag (<source>8</source>
) to the configuration tag of maven-javadoc-plugin. This is how the plugin element should look:
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<source>8</source>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
Next, change the dropwizard.version element to the latest version. Change it from this <dropwizard.version>1.0.0</dropwizard.version>
to this <dropwizard.version>2.0.11</dropwizard.version>
.
You can find the the dropwizard.version element in the properties element near the top of the POM file. This is how it should look:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<dropwizard.version>2.0.11</dropwizard.version>
<mainClass>com.gamingroom.gameauth.GameAuthApplication</mainClass>
</properties>
Updating the POM file by following the steps above should let you build your application, but if this doesn’t work for you, you’ll need to use Java 8.
Lastly, use the Dropwizard Hello World tutorial for building your application.
Let me know if you have questions.