This is not something I do often, as it’s a little long winded. First, edit the application.conf in the codegen project so that the output directories are all temp directories and won’t overwrite the real code - this means when you mess up the new code you are generating all the projects continue to build.

Open the sackfix project, and within that the sackfix-codegen module. Edit the src/main/resources/application.conf. Alter these values:

and all of the paths in the message output

ie stick it into another output directory. Now, run it once to see how it works, simply right click and run on org.sackfix.codegen.SfCodeGen. When it completes you will see all the generated code in your new output dirs.

An example change

Lets add a constant to each object in the message, giving the message type. The class to edit is SfCodeGeneratorMessage, adding this section of code :

def generateObject :String= {
  s"""object $generatedClassName extends $decoderSuperClass {
     |$generateFieldCheckMethods $generateFirstFieldForGroupsAndComponents $generateDecoder

I want to add a new message type constant, by adding a new method, lets say


And the method can be implemented as

private def generateMsgTypeConstant: String = {
  superClassParams match {
    case Some(params)=>s"  val MsgType=$params"
    case None =>""

I regenerate all the code again, drag a generated message into notepad, if I think it looks good, I then drag the message into another project, say the examples and make sure it compiles. If I am happy, I reset the paths in application.conf and generate one last time - this overwrites all the fields and messages.

Now I need to republish all the packages, as below

cd sackfix
cd ../sackfixmessages

This takes a long time, as it compiles everything and publishes them locally. Finally I go into the examples project and hit refresh in SBT, so it pulls in the new locally published versions of my code.