Skip to content

Commit 65f4299

Browse files
committed
Minor change to look for xml files from JAR. Added assembly for console bot.
1 parent 5c84f43 commit 65f4299

5 files changed

Lines changed: 39 additions & 13 deletions

File tree

JavaBot/dependency-reduced-pom.xml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,21 @@
44
<groupId>agk</groupId>
55
<artifactId>chatbot</artifactId>
66
<name>CBR Chat Bot</name>
7-
<version>2.3.1</version>
7+
<version>2.3.5</version>
88
<description>An interactive chat bot using case based reasoning.
99

1010
This web chat bot uses CBR techniques to have an English conversation with a user.
1111
It is a summer project I worked on while studying at the University of Auckland, over the 2016-2017 holidays.</description>
1212
<url>https://github.com/agkphysics/ChatBot</url>
1313
<build>
1414
<plugins>
15+
<plugin>
16+
<artifactId>maven-jar-plugin</artifactId>
17+
<version>3.0.2</version>
18+
<configuration>
19+
<excludes>xmlconv/**</excludes>
20+
</configuration>
21+
</plugin>
1522
<plugin>
1623
<artifactId>maven-resources-plugin</artifactId>
1724
<version>3.0.2</version>
@@ -33,13 +40,6 @@ It is a summer project I worked on while studying at the University of Auckland,
3340
</execution>
3441
</executions>
3542
</plugin>
36-
<plugin>
37-
<artifactId>maven-jar-plugin</artifactId>
38-
<version>3.0.2</version>
39-
<configuration>
40-
<excludes>xmlconv/**</excludes>
41-
</configuration>
42-
</plugin>
4343
<plugin>
4444
<artifactId>maven-shade-plugin</artifactId>
4545
<version>3.0.0</version>
@@ -85,6 +85,7 @@ It is a summer project I worked on while studying at the University of Auckland,
8585
<configuration>
8686
<outputDirectory>${project.build.directory}/depsrc</outputDirectory>
8787
<classifier>sources</classifier>
88+
<excludeTransitive>true</excludeTransitive>
8889
</configuration>
8990
</execution>
9091
</executions>
@@ -117,8 +118,9 @@ It is a summer project I worked on while studying at the University of Auckland,
117118
<descriptors>
118119
<descriptor>src/assembly/src.xml</descriptor>
119120
<descriptor>src/assembly/webapp.xml</descriptor>
121+
<descriptor>src/assembly/console.xml</descriptor>
120122
</descriptors>
121-
<tarLongFileMode>posix</tarLongFileMode>
123+
<tarLongFileMode>gnu</tarLongFileMode>
122124
</configuration>
123125
</plugin>
124126
</plugins>

JavaBot/pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>agk</groupId>
66
<artifactId>chatbot</artifactId>
7-
<version>2.3.1</version>
7+
<version>2.3.5</version>
88
<packaging>jar</packaging>
99

1010
<name>CBR Chat Bot</name>
@@ -222,8 +222,9 @@ It is a summer project I worked on while studying at the University of Auckland,
222222
<descriptors>
223223
<descriptor>src/assembly/src.xml</descriptor>
224224
<descriptor>src/assembly/webapp.xml</descriptor>
225+
<descriptor>src/assembly/console.xml</descriptor>
225226
</descriptors>
226-
<tarLongFileMode>posix</tarLongFileMode>
227+
<tarLongFileMode>gnu</tarLongFileMode>
227228
</configuration>
228229
<executions>
229230
<execution>

JavaBot/src/assembly/console.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
5+
<id>console</id>
6+
7+
<formats>
8+
<format>tar.bz2</format>
9+
</formats>
10+
11+
<fileSets>
12+
<fileSet>
13+
<directory>${project.build.directory}</directory>
14+
<outputDirectory>.</outputDirectory>
15+
<includes>
16+
<include>xmlconv/</include>
17+
<include>${project.build.finalName}.jar</include>
18+
</includes>
19+
</fileSet>
20+
</fileSets>
21+
</assembly>

JavaBot/src/assembly/webapp.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
55
<id>webapp</id>
6-
<baseDirectory>${project.build.finalName}-webapp</baseDirectory>
76

87
<formats>
98
<format>tar.bz2</format>

JavaBot/src/main/java/agk/chatbot/ChatBot.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public ChatBot(Path p) throws FileNotFoundException {
155155
if (p != null && Files.exists(p)) {
156156
corpusPath = p;
157157
} else {
158-
String[] locations = { "xmlconv", "lib/xmlconv", "xml", "xmlcorpus" };
158+
String[] locations = { "xmlconv/", "lib/xmlconv/", "xml/", "xmlcorpus/" };
159159
for (String loc : locations) {
160160
URL xmlURL = ChatBot.class.getClassLoader().getResource(loc);
161161
if (xmlURL != null) {
@@ -169,6 +169,9 @@ public ChatBot(Path p) throws FileNotFoundException {
169169
} catch (URISyntaxException e) {
170170
e.printStackTrace();
171171
}
172+
} else if (Files.exists(Paths.get(loc))) {
173+
corpusPath = Paths.get(loc);
174+
break;
172175
}
173176
}
174177
if (corpusPath == null) throw new FileNotFoundException("No valid corpus path given or found.");

0 commit comments

Comments
 (0)