To build and test Javabot, you'll need to do a few things.
Install MongoDB.
For Fedora, you can install it with
sudo yum install mongodb-server
On OS X, you can use
brew install mongo
If you're using Docker, you can run a Docker image for MongoDB:
docker pull mongo # note that docker-compose (see below) can do this for you.
(Note that if you're on Windows, you may need to add network translation to handle port 27017; see images/nat .png for how this would look in VirtualBox.)
Copy javabot-sample.properties to javabot.properties and update any properties as needed. If you want to run the web application
as well, copy javabot-sample.yml to javabot.yml and adjust as necessary.
Start mongodb; one example command, which will locate the data files in the
current directory, is this:
mongod --noauth --dbpath .
In Docker, you'd use:
docker run -d -p 27017:27017 --name mongodb mongo
You can also use the docker-compose-test.yml:
docker-compose -f docker-compose-test.yml up
You will need to download the JavaDoc manually thanks to licensing issues with Java. To do this, go to the Java download page and navigate to the Java version of your choice; you'll see a "JDK Download" and a "Documentation Download" link. Download the documentation, accepting licenses as appropriate; this will give you a file named, for example, if that's the version you chose. Copy that file to the directory, under the name - which is actually set in the file, under the key .
jdk-11.0.10_doc-all.zip
javabot
jdk-javadoc.jar
javabot.properties
javadoc.jdk.file
Build and test.
Developing
If you use IDEA, make sure you have "Use plugin registry" enabled in your Maven configuration.
Note also that IDEA may not pick up the generated java source as part of the build path; if Sofia does not
resolve after running mvn compile at least once, then open up the javabot.iml file and add
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> under the <content> XML node.
<content> should look like this:
The bot may take attempt to cycle through servers on testnet to connect if they are unavailable. Once it has been connected, invite it to a channel (e.g. /invite tk-421 ##tk421-javabot-test) and issue commands to it.
Javabot's server config can be changed after it has been initialized by connecting directly to mongodb as follows:
$ mongo
> use javabot-sample
switched to db javabot-sample
> db.configuration.update({}, {$set:{"server":"irc.libera.chat","port":6697}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 0 })