Browse Source

Convert project from makefile to maven

pull/3/head
Gregory Rudolph 4 years ago
parent
commit
1ae69b5558
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 44
      .classpath
  2. 3
      .gitignore
  3. 34
      .project
  4. 3
      .settings/org.eclipse.core.resources.prefs
  5. 2
      .settings/org.eclipse.jdt.apt.core.prefs
  6. 9
      .settings/org.eclipse.jdt.core.prefs
  7. 4
      .settings/org.eclipse.m2e.core.prefs
  8. 3
      .vscode/settings.json
  9. 38
      Makefile
  10. 100
      pom.xml
  11. 31
      src/main/java/MTGClone/App.java
  12. 2
      src/main/java/MTGClone/Card.java
  13. 2
      src/main/java/MTGClone/Deck.java
  14. 1
      src/main/java/MTGClone/Driver.java
  15. 2
      src/main/java/MTGClone/Game.java
  16. 1
      src/main/java/MTGClone/Player.java
  17. 2
      src/main/java/MTGClone/SQLDriver.java

44
.classpath

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

3
.gitignore vendored

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
*.class
manifest.txt
*.jar
target/
.DS_Store
cards.db

34
.project

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MTGClone</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
<filteredResources>
<filter>
<id>1600989245301</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>

3
.settings/org.eclipse.core.resources.prefs

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding/<project>=UTF-8

2
.settings/org.eclipse.jdt.apt.core.prefs

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=false

9
.settings/org.eclipse.jdt.core.prefs

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=11

4
.settings/org.eclipse.m2e.core.prefs

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

3
.vscode/settings.json vendored

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}

38
Makefile

@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
JCC = javac
MAIN_CLASS = Driver
OUT_JAR = MTGClone.jar
SQLITE_JDBC_VER = 3.32.3.2
SQLITE_JDBC_JAR = sqlite-jdbc-$(SQLITE_JDBC_VER).jar
SQLITE_JDBC = https://github.com/xerial/sqlite-jdbc/releases/download/$(SQLITE_JDBC_VER)/$(SQLITE_JDBC_JAR)
JFLAGS = -g -classpath ".:$(SQLITE_JDBC_JAR)"
default:
@echo \"make build\" to compile Java classes
@echo \"make run\" to run Driver class
@echo \"make jar\" to compile executable jar
@echo \"make clean\" to clean up artifacts
sqlite_jdbc:
wget -N $(SQLITE_JDBC)
build: sqlite_jdbc
$(JCC) $(JFLAGS) $(MAIN_CLASS).java
run: jar
java -jar $(OUT_JAR)
jar: build
@echo "Manifest-Version: 1.0" > manifest.txt
@echo "Class-Path: ./sqlite-jdbc-3.32.3.2.jar" >> manifest.txt
@echo "Main-Class: $(MAIN_CLASS)" >> manifest.txt
@echo "" >> manifest.txt
jar -cmf manifest.txt $(OUT_JAR) *.class
$(RM) manifest.txt
$(RM) *.class
clean:
$(RM) *.class
$(RM) cards.db
$(RM) manifest.txt
$(RM) $(OUT_JAR)
$(RM) $(SQLITE_JDBC_JAR)

100
pom.xml

@ -0,0 +1,100 @@ @@ -0,0 +1,100 @@
<?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>MTGClone</groupId>
<artifactId>MTGClone</artifactId>
<version>1.0</version>
<name>MTGClone</name>
<url>https://github.com/jordanmason-stleo/MTGClone</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.32.3.2</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>MTGClone.Driver</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>MTGClone.Driver</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

31
src/main/java/MTGClone/App.java

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
package MTGClone;
import java.util.Scanner;
public class App {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter Player One's name: ");
String player1Name = in.nextLine();
System.out.print("Enter Player Two's name: ");
String player2Name = in.nextLine();
Deck deck=new Deck();
Deck deck2=new Deck();
Player player1= new Player(deck, player1Name);
Player player2= new Player(deck2, player2Name);
Game game= new Game(player1, player2);
while(player1.lifeTotal>=0&&player2.lifeTotal>=0){
if (game.player1.lifeTotal>0)
game.Turn(game.player1,game.player2,in);
System.out.println("------------------------------------------------------------------------------------------------------------------------------");
if (game.player2.lifeTotal>0)
game.Turn(game.player2,game.player1,in);
System.out.println("------------------------------------------------------------------------------------------------------------------------------");
}
in.close();
}
}

2
Card.java → src/main/java/MTGClone/Card.java

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
package MTGClone;
public class Card{
protected String cardName;
protected int manaCost;

2
Deck.java → src/main/java/MTGClone/Deck.java

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
package MTGClone;
import java.util.ArrayList;
import java.util.Collections;

1
Driver.java → src/main/java/MTGClone/Driver.java

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
package MTGClone;
import java.util.Scanner;
public class Driver {
public static void main(String[] args) {

2
Game.java → src/main/java/MTGClone/Game.java

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
package MTGClone;
import java.util.ArrayList;
import java.util.Scanner;

1
Player.java → src/main/java/MTGClone/Player.java

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
package MTGClone;
import java.util.Scanner;
public class Player {

2
SQLDriver.java → src/main/java/MTGClone/SQLDriver.java

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
package MTGClone;
import java.sql.*;
import java.util.*;
Loading…
Cancel
Save