Create your first CodeVille Java program
- Launch IntelliJ.
- Create a new maven type project.
- If Project SDK is empty, then click "New" and select the JDK folder like so:
GroupID and ArtifactID can be any words you like. GroupID typically takes the form of "com.google", "com.yourname", etc.
Open pom.xml, copy and paste
<dependencies>
and<repositories>
tags from the following code:<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.helen.games</groupId> <artifactId>codeville-game</artifactId> <version>1.0-SNAPSHOT</version> <!-- copy and paste the code below --> <dependencies> <dependency> <groupId>com.buzzcoder.games</groupId> <artifactId>codeville</artifactId> <version>0.4.0</version> </dependency> </dependencies> <repositories> <repository> <id>buzzcoder</id> <url>http://dl.bintray.com/buzzcoder/games</url> </repository> </repositories> <!-- end of code --> </project>
- Create your class:
import java.io.IOException;
import com.buzzcoder.codeville.CodeVille;
import com.buzzcoder.codeville.CodeVilleResponse;
import com.buzzcoder.codeville.Gender;
public class game {
public static void main(String[] args) throws IOException {
CodeVille game = new CodeVille();
CodeVilleResponse response = game.connect("Your Name", "", Gender.boy);
}
}
Here is a complete example of Java program with two java classes: Sample.java:
Solutions.java: