# Ant build terminates with no messages

• I have been going through the video on building Mango, and while the video is rough to follow, I have been successful up to the Ant build portion. When I first did the ant build using Core/build.xml, as per the video, it started show build messages just like the video, then suddenly the Console was cleared and the only message, at the very top of the console was:

<terminated> Core build.xml[Ant Build] C:\Program Files\Java\jdk1.8.0_111\bin\javaw.exe (current time stamp)

Now everytime I retry the Ant build, nothing shows in the console, not even the starting of the build, it just immediately shows the "terminated" header line.

For reference, I am running Windows 7 Pro, and my eclipse install is Neon-2.

• Hi mattdem,

The build tools have largely changed since that video was created. If you are building against the 2.8 or the main branches, i would advise using Maven to build it.

In ma-core-public (not the core, but the repository folder with the CoreBundle, Core and other projects), do a mvn install

To install a module, create a settings.xml file like this one:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>install-module</id>
<properties>
<MA_HOME>C:\path\to\ma-core-public\Core</MA_HOME>
</properties>
</profile>
</profiles>
</settings>


Then run this command inside the module's project folder:

mvn -s C:\path\to\settings.xml -P install-module install package


which will compile the module's zip into the Core/web/modules/ directory as well as the module's maven-target directory.

To debug in eclipse, create a new debug configuration and scan the CoreBundle project for Main classes. You're looking for com.serotonin.m2m2.Main. You most likely wish to supply VM arguments like

-Dma.home="C:\path\to\ma-core-public\Core"
-Dlog4j.configuration=file:C:\path\to\ma-core-public\Core\classes\log4j.xml -Xmx4g


I have already done the mvn install as this was covered in the video.
Beyond that, I am working from within Eclipse and the video does have a part about doing a maven install running against the pom.xml in Core. What is the difference between what the pom.xml is doing and what you are recommending above. I apologize in advance if I seem a bit naive, but I really have not worked extensively with maven, and certainly not with the Mango environment, which I am trying to understand.

Ultimately, what I am after is first a successful build and then I wish to create a driver for a proprietary protocol, for which the driver is going to have a complexity level nearly equal to BACnet. So I guess, eventually, I am going to need to understand how that part all builds in too.

Thanks.

• If you've done the mvn install through eclipse it should be the same as doing it on the command line. You should be able to search the CoreBundle project in debug configurations for the Main class i described and launch Mango through Eclipse.

It could also be important to know what branch you are on. Main?

• If 2.8, then you should be able to find that Main class in the Core project. Presumably in your Ant runtime you have declared the property coreHome = ${core.project.home} and set core.project.home in your Window --> Preferences --> Run / Debug --> String substitution as being the C:\path\to\ma-core-public\Core • I am not familiar with your reference to Main. Again, where I am at is following the video, I pulled the code from git, I believe the current that pulled is 3.0.0. As to your references about setting the Ant runtime stuff, yes that has been done, again as is shown in the video (sorry to keep referencing back to the video, but at this point, that is the only reference I have, broken as it is). And why do you refer to the Ant settings, I thought I understood you to say it is all pretty much done though maven now. And it is the Ant that is failing (which I would thus be happy to leave behind). Thanks • I was unsure what branch you're on, but it sounds like the main branch, which should only require Maven. I brought up the Ant setting in case you were on the 2.8 branch of ma-core-public You should be able to go to "Debug Configurations" --> "New Configuration" --> Project: CoreBundle (import projects from ma-core-public if you do not have it) --> browse main classes for com.serotonin.m2m2.Main --> use VM arguments supplied but changed for your path --> launch Mango • Phil, I want to thank you for your help, but I am still not there. I am sure for you a lot of this is just second nature and so the steps are simple, for me not so much. So, from within Eclipse, I can run the maven install on the Core bundle and it completes successfully... Does that complete all builds then by inclusion or must separate builds be performed for other bundles? Once the build(s) are done, on to the debugging. You instructions seem a bit incomplete from my perspective... "Debug Configurations"...can get there.... "New Configuration"...can select that, brings up a new blank form...I chose to name my new configuration "Mango", figured that's creative enough. Now, Main tab... "Base directory:"...I am assuming you mean that to be${workspace_loc/CoreBundle}
"Goals:"...install (?)
"Profiles:"...currently blank
"User settings:"...\${workspace_loc/CoreBundle/pom.xml} (??)
Everything else defaulted???
I don't know. I really would like a bit more than just what needs to be set where but why. What do the various settings do and how do they relate to the whole of the Mango build? What changes if any are necessary on the other tabs (JRE, Refresh, Source, Environment, Common)?

• Matt,

It is one of those things you only have to do every now and again, so there's a lot of room for it to be slippery in my mind.

You don't need to mvn install the CoreBundle project. It's useful if you wish to produce a zip of the Mango core, but for general development you can just run mvn install in the ma-core-public project (if using eclipse) or just in the ma-core-public directory if using the command line. Sounds like this part has worked already.

I think the step I left out was clicking the "Java Application" section of the debug configurations menu.

Your JRE will just need to be the same JRE used to mvn install (otherwise you will get a major-minor version conflict). The VM arguments for the arguments tab are in my earlier post (you'll need to change the paths and possibly the allocated memory). You shouldn't have to do anything on any other tab.

It's also possible that I'm forgetting something. I've got a computer at home i haven't set up to build Mango yet. I'll give it a go tonight and perhaps shoot a video of the setup, since the old video is definitely deprecated.

• So that makes much more sense to me, however, when I select CoreBundle and search for main classes, it comes up with quite a list, but nothing in that list is com.serotonin.m2m2.Main or any subset of com, serotonin or m2m2. You mentioned something about importing the projects may be necessary, however, I cannot see what to import...I go looking and all I can seem to find is that the projects, including CoreBundle are already imported.

• Well, long way around to get back to where I was before...
Setup the debug configuration, I tried just typing in the "com.serotonin.m2m2.Main" and running debug to see what would happen...it falls over in the ant build! Seems I still cant get away from the ant build problems. Note that the error I got was the same as the error in the video, but I DO have the "core.project.home" set, so the solution is not the same as the video.

I do appreciate that you are going to take a look at this tonight, but in the mean time, I am continuing to try to make progress (nothing better to do as this is my priority project at the moment).

Thanks.

• I sent you an email!

• Hi Matt,

Thanks for your patience yesterday, it was unfortunate timing to find the build system in that state. The builds are back to good and working order, so I encourage you to give it another try today! You'll need to,

-1) Set up Java and Maven (which I know you've already done, but for others)
0) Delete C:\Users\username\.m2\repository\com\infiniteautomation\mango for a clean slate.

1. Pull ma-core-public
2. In Eclipse, right click on the pom.xml in the ma-core-public project and run as maven install (or 'mvn install' inside the ma-core-public folder on the command line)
3. Create a debug configuration, new Java Application, project = CoreBundle find com.serotonin.m2m2.Main class, use VM arguments as described in previous posts.

IF com.serotonin.m2m2.Main does not appear in the list, right click on the CoreBundle project, go to Maven --> Update Project (Alt+F5). Try to search for Main classes again, you should be able to find com.serotonin.m2m2.Main now

Currently git is required to do a mvn install on the CoreBundle, but you shouldn't have to do a Maven install on this unless you are building a core zip. I suspect this dependency was not 100% intentional and will be excised sooner or later.

• Phil,
Sorry, had a delay in getting back to trying this out...
Sad new, it still does not work. I even went so far as to completely remove my local get repository and then pull the ma-core-public and ma-modules-public again. From within Eclipse the maven install runs and completes. But even if I do the maven update on the coreBundle, com.serotonin.m2m2.Main does not exist.

• Hi Matt,

No worries. Sorry it's not proving to be so straightforward!

Can you try copying ma-core-public\Core\maven-local\com\infiniteautomation\mango\ma-priv to C:\Users\username\.m2\repository\com\infiniteautomation\mango\ma-priv (delete the existing folder before copy) and searching for the Main class again?

• Also, you may wish to copy the env.properties and the i18n.properties files from ma-core-public\Core\classes\ to ma-core-public\Core\maven-target\classes\ and modify env.properties there. You could move the log4j configuration too, if you're not providing it explicitly as a VM argument.

• And so the saga continues:
Sorry again for the delay, seems business keeps getting in the way of progress.
Still no joy.
Also, you talk about env.properties and i18n.properties, what are the purposes of these files.

• The env.properties file has various settings that will affect Mango, settings which do not change at runtime.

The i18n.properties file has translation values for the default case (English) because Mango supports translation.

Hmm. I did it on my fresh computer, completely clean install, and assuredly shared all steps done. I guess I'll do it again later.

• So, while I continue to not succeed, let me pose this question. The driver I am ultimately wanting to develop is in many ways, nearly as complex as BACnet MS/TP, certainly more complex than Modbus, both of which are separate development trees. Would I be better off looking at these as working examples to develop my driver or does that still require what we are trying to accomplish here in getting the basic Mango to build?

• You are building this driver for Mango? If so you'll want to be able to run Mango in a debugger possibly. If you can build modules (mvn install in the module's directory) and you get its zip into maven-target then you could do all your testing on an existing Mango instance, sure.

Both the Modbus and BACnet data sources are private, but the protocol implementations are open.