It is currently 27 Aug 2025, 23:43
   
Text Size

Maven build file - generation of OSX, Windows, Linux files

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Maven build file - generation of OSX, Windows, Linux files

Postby jendave » 06 Jun 2011, 14:57

I checked in some work on a Maven build file ("pom.xml"). It will generate OSX, Windows and Linux tar.gz files for distribution. For OSX, it will create the .app bundle and put it in a .dmg file first. If desired, the Maven file will upload the resultant packages to the GoogleCode "Download" area. This can all be easily done from the command line. If you are using OSX, you can build all the packages for OSX, Windows and Linux. I made the Maven-generated packages as similar as possible to the ones that are currently distributed.

Maven can also do a lot of other things easily such as: generating JavaDocs, code-style checking, license checking, project website creation and much more.

Thoughts?
jendave
 
Posts: 307
Joined: 01 Jun 2008, 07:19
Has thanked: 8 times
Been thanked: 21 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby Rob Cashwalker » 06 Jun 2011, 15:16

I was wondering what that thing was...
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby Chris H. » 06 Jun 2011, 16:33

jendave wrote:I checked in some work on a Maven build file ("pom.xml"). It will generate OSX, Windows and Linux tar.gz files for distribution. For OSX, it will create the .app bundle and put it in a .dmg file first. If desired, the Maven file will upload the resultant packages to the GoogleCode "Download" area. This can all be easily done from the command line. If you are using OSX, you can build all the packages for OSX, Windows and Linux. I made the Maven-generated packages as similar as possible to the ones that are currently distributed.

Maven can also do a lot of other things easily such as: generating JavaDocs, code-style checking, license checking, project website creation and much more.

Thoughts?
`
I want to thank you for your efforts Dave. :)

My profile lists me as a programmer. I took several intro classes in college many years ago but my skill level falls far short of the other people on our team.

I may need to ask some questions and I may need some help in getting up to speed. :) Does the Maven build file include the lib folder and the libraries that are inside of this folder? And are the hidden .SVN folders with their files included in the archives that are built?

I quickly visited the Maven site and created a bookmark. I may need some help in figuring out how to install it. Overall, this looks very interesting. I spend hours creating the archives by hand and it does get repetitive. An automation type process should help in this area.

I see that you merged the CHANGES.txt and the README.txt files into the SVN. I can update the CHANGES.txt file on the SVN through Eclipse before I build the archives.

I also noticed that we now have forge icons for both Mac OS and for Windows located in the build folder. And you decided to use the globe based icon for both OS's. Nice touch.

Another person, nerzahd, put together the original Mac OS icon and a dmg package of forge for Mac OS. This was some time ago. I still have a link to the original topic in case you are interested in the history.

Forge Mac OS X Binary
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby jendave » 06 Jun 2011, 19:18

Thanks for the feedback. I am a professional programmer (Java and C#) though my recent efforts are mainly in Build Management (Maven, Ant, SVN, Perforce etc). The purpose of the Maven build is to create deployable packages easily for testing and release purposes. It is not really meant to be part of the normal code, compile, debug process. I am trying to streamline to build process so one simple command line will create OSX/Win/Linux packages and upload them to a repository (GoogleCode Downloads appears to be the most obvious candidate).

Regarding your questions -
1. Does Maven use the lib directory? Not really. I configured the build so it so Maven is aware of the library dependencies that Forge requires (the contents of the lib directory). Maven will then download those libraries from the internet and then wrap them up in a jar. The final jar created in all the builds includes the dependencies and has a manifest file with the main-class. Therefore, the resultant jar is runnable from the get-go.

2. Do the packages include the .svn files? No. Maven automatically ignores these files when creating the packages.

To fully create a set of packages for all platforms and upload them to Google should take about 20-30 minutes (though the very first time you do it may take a little longer due to downloads of the deps). Notably, it would be unattended - one command line running in the background would do it.

"mvn -U clean install" // full build, package, no uploads - good for testing
"mvn -U clean install release:prepare release:perform" //full build, package, upload to GoogleCode - meant for final release

Maven can also be used to create many developer resources: JavaDocs, codestyle reports. Those can be automatically uploaded to the web as well.

I could do some builds, post them to the web and provide the links. Then you could decide if my Maven builds are something you guys want to use.

Thanks
Dave
jendave
 
Posts: 307
Joined: 01 Jun 2008, 07:19
Has thanked: 8 times
Been thanked: 21 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby jendave » 06 Jun 2011, 19:27

Thanks for the link to the previous discussion. I see that the old dmg file has a draggable install for OSX. I'll see if I can add that into the build process so it is always used in the package.
jendave
 
Posts: 307
Joined: 01 Jun 2008, 07:19
Has thanked: 8 times
Been thanked: 21 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby Chris H. » 06 Jun 2011, 23:07

It may take a while for me to figure this out.

I used a utility to make hidden files and folders visible on my Apple iMac. I found the hidden /usr/local/ folders where the subdirectory apache-maven-3.0.3 will be created from the archive.

I downloaded the archive and I now have a directory path of:

Macintosh HD/usr/local/apache-maven/apache-maven-3.0.3

At this point I am supposed to do the following as part of the installation instructions:

In a command terminal, add the M2_HOME environment variable, e.g. export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.3.
.
I can launch the terminal application without any problems but I am unsure how to actually add the M2_HOME environment variable.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby Chris H. » 07 Jun 2011, 01:44

Chris H. wrote:I can launch the terminal application without any problems but I am unsure how to actually add the M2_HOME environment variable.
`
I launched the terminal and typed in "man export" and got the man page and it is listed as a command.

The Maven install instructions state:

Unix-based Operating Systems (Linux, Solaris and Mac OS X)

1. Extract the distribution archive, i.e. apache-maven-3.0.3-bin.tar.gz to the directory you wish to install Maven 3.0.3. These instructions assume you chose /usr/local/apache-maven. The subdirectory apache-maven-3.0.3 will be created from the archive.

2. In a command terminal, add the M2_HOME environment variable, e.g. export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.3.

3. Add the M2 environment variable, e.g. export M2=$M2_HOME/bin.

4. Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g. export MAVEN_OPTS="-Xms256m -Xmx512m". This environment variable can be used to supply extra options to Maven.

5. Add M2 environment variable to your path, e.g. export PATH=$M2:$PATH.

6. Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=/usr/java/jdk1.5.0_02 and that $JAVA_HOME/bin is in your PATH environment variable.

7. Run mvn --version to verify that it is correctly installed.
.
I have finished the first step.

I think that I know how to do steps 2 and 3.

Step 4 is optional and I guess that I can most likely skip this step.

Step 5 is similar to steps 2 and 3.

I am not sure what I should do about steps 6 and 7.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby jendave » 07 Jun 2011, 07:09

6. Make sure to export the JAVA_HOME variable
something like: export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home

Where are you putting the export statements? I put them into my .bash_profile file which is located in my HOME directory.

7. simply execute 'mvn --version' from the command line. It should give you something similar to:
Apache Maven 3.0.3 (r1075438; 2011-02-28 09:31:09-0800)
Maven home: /opt/local/share/java/maven3
Java version: 1.6.0_24, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.6.7", arch: "x86_64", family: "mac"
jendave
 
Posts: 307
Joined: 01 Jun 2008, 07:19
Has thanked: 8 times
Been thanked: 21 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby jendave » 07 Jun 2011, 08:41

I just checked in changes to the pom.xml file that creates a DMG similar to the one posted earlier in the thread - it has the same background image and drag-n-drop installation.
jendave
 
Posts: 307
Joined: 01 Jun 2008, 07:19
Has thanked: 8 times
Been thanked: 21 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby Chris H. » 07 Jun 2011, 11:37

jendave wrote:6. Make sure to export the JAVA_HOME variable
something like: export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
`
I found the path located in the Eclipse preferences and as you state it is listed as:

/System/Library/Frameworks/JavaVM.Framework/Versions/1.6.0/Home

Where are you putting the export statements? I put them into my .bash_profile file which is located in my HOME directory.
`
I can launch the terminal.app and it opens with a bash shell as the default. I could copy and paste the export commands listed in the install instructions. But this seemed to be only a temporary type of solution.

I opened the "Home" folder from the path above but there is no hidden file named ".bash_profile" located inside of the "Home" folder. There are 3 folders and 2 aliases to folders inside of the "Home" folder.

I guess that I could create a ".bash_profile" file with the TextEdit app and then move into the "Home" folder.

Typing "mvn --version" into the terminal app with the bash shell may then give me the results listed below:

7. simply execute 'mvn --version' from the command line. It should give you something similar to:
Apache Maven 3.0.3 (r1075438; 2011-02-28 09:31:09-0800)
Maven home: /opt/local/share/java/maven3
Java version: 1.6.0_24, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.6.7", arch: "x86_64", family: "mac"
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby Chris H. » 07 Jun 2011, 12:19

OK, It appears that I have Maven installed even though I do not have the .bash_profile file in the Home folder.

I entered these lines into the Terminal.app:

export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.3
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
export JAVA_HOME=/System/Library/Frameworks/JavaVM.Framework/Versions/1.6.0/Home
`
I then entered the "mvn --version" command and the following is displayed:

Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500)
Maven home: /usr/local/apache-maven/apache-maven-3.0.3
Java version: 1.6.0_24, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.6.7", arch: "x86_64", family: "mac"
`
I then restarted the computer and ran the "mvn --version" command in the terminal app and the same data is listed in the bash window. It appears that I can now run maven without the .bash_profile file.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby jendave » 07 Jun 2011, 14:36

Looks good. Strange though, the export commands should not be saved after a reboot unless they are in a file (.bash_profile, .bashrc are common). In any case, go to your svn checkout of forge in the terminal ('cd /path/to/forge') and execute this command
'mvn -U clean install'

That may take awhile since it is the first time and will download all sorts of deps. Hopefully you will get a "BUILD SUCCESS".
jendave
 
Posts: 307
Joined: 01 Jun 2008, 07:19
Has thanked: 8 times
Been thanked: 21 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby slapshot5 » 07 Jun 2011, 14:47

Hi Dave,

Thanks for all your efforts in this.

Wondering if you'd be willing the get the Ant build.xml file up-to-snuff?

Thanks,
slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby jendave » 07 Jun 2011, 14:55

Thanks. I am hesitant to work on the Ant files since it would essentially duplicate the Maven work. I am hoping to move on to working on other parts of Forge. Are there features in the build that you need?
jendave
 
Posts: 307
Joined: 01 Jun 2008, 07:19
Has thanked: 8 times
Been thanked: 21 times

Re: Maven build file - generation of OSX, Windows, Linux fil

Postby friarsol » 07 Jun 2011, 15:25

Hey Dave,

Looks good on my end. The one thing we don't want is the /res/pics folder being packaged up. My pics folder is >500 Megs and has about 20k files. Considering the package is trying to tar 29k files, this is taking the heaviest load, along with creating a 500 MB Tar file. Is there a way to create a structured package (to allow for /res/pics/tokens folder existing, but empty) in Maven?

Otherwise, whoever is in charge of builds would probably need to have a second barebones checkout simply for creating the build (which isn't a bad idea in the long term).

Thanks for setting this up, should make Chris' life a load easier.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Next

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 16 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 16 users online :: 0 registered, 0 hidden and 16 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 16 guests

Login Form