It is currently 28 Aug 2025, 11:21
   
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

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

Postby jendave » 07 Jun 2011, 15:38

Yes. A release build should always be done with a fresh "barebones" checkout - never with a working copy.

I have uploaded a snapshot version of the packages to my Google Site as a test to show how the packages would look

OSX package
Windows/Linux package

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 slapshot5 » 07 Jun 2011, 15:45

jendave wrote: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?
I was hoping to be able to build Forge from the FreeBSD ports system using Ant. Not sure how much they do with Maven. I'll have to look into that.

-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, 15:53

slapshot5 wrote:I was hoping to be able to build Forge from the FreeBSD ports system using Ant. Not sure how much they do with Maven. I'll have to look into that.

-slapshot5
http://www.freebsd.org/cgi/cvsweb.cgi/p ... el/maven2/

Maven2 is the previous version (Maven3 is out), but it is the most stable. Debian also uses Maven2. I have tested the build on Debian so it will likely be fine on FreeBSD. I am trying to keep the Forge build file compatible with both Maven3 and Maven2.

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 Chris H. » 07 Jun 2011, 16:47

jendave wrote: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".
`
I have Eclipse set up with 2 workspaces. One workspace contains my local coding efforts and the other workspace contians a pristene copy of the project on our SVN. So i am good to go in this respect.

I opened the terminal app and set the path to my pristene copy of the project on our SVN. I entered the mvn -U clean install command and a few minutes later I have:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9:30.364s
[INFO] Finished at: Tue Jun 07 12:33:44 EDT 2011
[INFO] Final Memory: 31M/116M
[INFO] ------------------------------------------------------------------------
`
My pristene copy of the project on our SVN now has a new folder named target. There are a number of files and folders in the folder named target. It looks like these two files are the ones that we release:

forge-1.0.0-SNAPSHOT.dmg
forge-1.0.0-SNAPSHOT.tar.bz2
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, 16:57

Great!

The files you will want should be
forge-1.0.0-SNAPSHOT.osx.tar.bz2 // OSX, unzips to a DMG file
forge-1.0.0-SNAPSHOT.tar.bz2 //Windows and Linux

Now there is some more configuration that needs to be done before the final steps. In your home directory there should now be a hidden .m2 directory. In that directory there should be a settings.xml file. Open it. Add a section that looks like this:
Code: Select all
   <servers>
        <server>
            <id>googlecode</id>
            <username>username@gmail.com</username>
            <password>mypassword</password>
        </server>
    </servers>
Add your GoogleCode username and svn commit password. This will allow MAven to autmoatically update the version number Forge and check it into SVN. It will also allow for the uploads of the tar files.

Then try this command
Code: Select all
mvn -U --batch-mode clean install release:prepare -DdryRun=true
This is a "dryrun" of the final release. It won't actually modify any files, but it will check to make sure everything is in order. Make sure to have any changes checked into SVN.

Once that works (i.e. BUILD SUCCESS), try this for the final release:

Code: Select all
mvn -U --batch-mode clean install release:prepare release:perform
This will make final release packages for Window/Linux and OSX. It will upload them to the CardForge Google.
The files in question should be:
The files you will want should be
forge-1.0.0.osx.tar.bz2
forge-1.0.0.tar.bz2
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, 17:27

Thank you for your help.

I will get back to you once I have tried out these additional steps. Looks good so far.
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, 19:10

jendave wrote:Now there is some more configuration that needs to be done before the final steps. In your home directory there should now be a hidden .m2 directory. In that directory there should be a settings.xml file. Open it. Add a section that looks like this:
Code: Select all
   <servers>
        <server>
            <id>googlecode</id>
            <username>username@gmail.com</username>
            <password>mypassword</password>
        </server>
    </servers>
Add your GoogleCode username and svn commit password. This will allow MAven to autmoatically update the version number Forge and check it into SVN. It will also allow for the uploads of the tar files.
`
I found a hidden .m2 directory located at:

/Macintosh HD/Users/My Account/.m2/

This folder contains the following:

.DS_Store
/repository/

There does not appear to be a settings.xml file or any .xml files inside of the /Macintosh HD/Users/My Account/.m2/ folder. Strange. There are a number of files with settings in the file name.

/Macintosh HD/Users/My Account/.m2/respository/org/apache/maven/maven-settings/

contains files with names "maven-settings-" with additional chars which include "pom". But this is not what I am looking for...

When I do a file search on my HD looking for a file named "settings.xml" I get a number of hits:

/usr/share/maven 1/conf/settings.xml
/usr/share/java/maven-2.2.0/conf/settings.xml
/usr/share/java/maven-2.2.1/conf/settings.xml
/usr/share/java/apache-maven-2.0.9/conf/settings.xml
/usr/share/java/maven-3.0.2/conf/settings.xml
/usr/local/apache-maven/apache-maven-3.0.3/conf/settings.xml

It appears that my Mac OS came with maven pre-installed.

At this point I am a little lost and am unsure of what my next step should be.
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, 20:29

In /Macintosh HD/Users/My Account/.m2/ directory create a new file called settings.xml. It should live next to "repository" in the .m2 directory. The contents of settings.xml should be like this.

Code: Select all
<?xml version="1.0"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0            http://maven.apache.org/xsd/settings-1.0.0.xsd">
        <servers>
        <server>
            <id>googlecode</id>
            <username>youremail@gmail.com</username>
            <password>yourpassword</password>
        </server>
    </servers>
</settings>
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, 21:48

jendave wrote:In /Macintosh HD/Users/My Account/.m2/ directory create a new file called settings.xml. It should live next to "repository" in the .m2 directory. The contents of settings.xml should be like this.

Code: Select all
<?xml version="1.0"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0            http://maven.apache.org/xsd/settings-1.0.0.xsd">
        <servers>
        <server>
            <id>googlecode</id>
            <username>youremail@gmail.com</username>
            <password>yourpassword</password>
        </server>
    </servers>
</settings>
`
I created the settings.xml file and was able to execute the test build command:

mvn -U --batch-mode clean install release:prepare -DdryRun=true

Apparently, the gmail address and it's password is not being recognized? The project will build in the target folder but it does not get an updated version number.

The terminal states "Building Forge 1.0.0-SNAPSHOT" and I suspect that I am supposed to get a version number other than 1.0.0 instead if things were working correctly?
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, 22:14

Sorry, I was not clear enough in my previous post. "release:prepare" will make sure everything is ok (compiles, tests etc) but it will not iterate the version number. "mvn release:perform" will do that. So it looks like you are good to go. Note, if there is a failure you may want to do a
Code: Select all
mvn release:rollback
mvn release:clean
Fix the problem (whatever it may be). Then
Code: Select all
mvn release:prepare
mvn release:perform
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. » 08 Jun 2011, 01:49

jendave wrote:Once that works (i.e. BUILD SUCCESS), try this for the final release:

Code: Select all
mvn -U --batch-mode clean install release:prepare release:perform
This will make final release packages for Window/Linux and OSX. It will upload them to the CardForge Google.
The files in question should be:
The files you will want should be
forge-1.0.0.osx.tar.bz2
forge-1.0.0.tar.bz2
`

I have now tried the second step

mvn -U --batch-mode clean install release:prepare release:perform

several times and it ends with a build failure. I was not sure if the password in the settings.xml file was for my gmail account or for my GoogleCode.com Password so I tried both of them and the result is the same, a build failure.

this is not the entire output to the terminal app, it is just the last several dozen lines and it may provide some helpful data.

Code: Select all
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Forge 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.0:prepare (default-cli) @ forge ---
[INFO] Release preparation already completed. You can now continue with release:perform, or start again using the -Dresume=false flag
[INFO]
[INFO] --- maven-release-plugin:2.0:perform (default-cli) @ forge ---
[INFO] Checking out the project to perform the release ...
[INFO] Executing: /bin/sh -c cd /Users/chrish/workspace/ForgeSVN/target && svn --non-interactive checkout https://cardforge.googlecode.com/svn/src/tags/forge-1.0.0 /Users/chrish/workspace/ForgeSVN/target/checkout
[INFO] Working directory: /Users/chrish/workspace/ForgeSVN/target
[ERROR] The svn command failed.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:00.861s
[INFO] Finished at: Tue Jun 07 21:34:33 EDT 2011
[INFO] Final Memory: 33M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:perform (default-cli) on project forge: Unable to checkout from SCM
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] svn: URL 'https://cardforge.googlecode.com/svn/src/tags/forge-1.0.0' doesn't exist
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
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 » 08 Jun 2011, 06:26

Hmmm. Strange. I suggest you try a
Code: Select all
mvn clean release:clean
Then try the full
Code: Select all
mvn -U --batch-mode clean install release:prepare release:perform
It is possible that the release:prepare -DdryRun=true left some extra files that need to be cleaned out before a release:perform. Also since the dryrun does not modify SVN, that would explain why Maven could not find the tag in SVN.

My main concern at this point is that since my computer's command line environment is pretty extensive (I use Macports to provide a huge amount of the Linux-type utilities), there may be a couple more deps that you will encounter that I usually don't see. If you see an error with "gpg" let me know.

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 Chris H. » 08 Jun 2011, 14:42

The

Code: Select all
mvn clean release:clean
`
succeeds and removes the target folder from my workspace.

From there I have tried the

Code: Select all
mvn -U --batch-mode clean install release:prepare release:perform
`
command and I get the following error:

Code: Select all
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Forge 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.0:prepare (default-cli) @ forge ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:27.345s
[INFO] Finished at: Wed Jun 08 10:32:30 EDT 2011
[INFO] Final Memory: 33M/116M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project forge: You don't have a SNAPSHOT project in the reactor projects list. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
`
Once again I have tried with my settings.xml file set with my gmail password and with the GoogleCode.com password. I get the same error either way.

When visiting the URL above it states that:

Unlike many other errors, this exception is not generated by the Maven core itself but by a plugin. As a rule of thumb, plugins use this error to signal a failure of the build because there is something wrong with the dependencies or sources of a project, e.g. a compilation or a test failure.
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 » 08 Jun 2011, 15:00

Are there any other files lingering in the forge directory such as "release.properties" or pom.xml.backup? Check the version number of forge that appears in the pom.xml. It may have been iterated to 1.0.0. It should be 1.0.0-SNAPSHOT. Make sure to revert the pom.xml if that is the case. The line in the error log saying "[INFO] Building Forge 1.0.0" does not look right. It should say "[INFO] Building Forge 1.0.0-SNAPSHOT" at that point. Is there a way to communicate in realtime? You can PM me with contact info if you'd like.
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 » 08 Jun 2011, 15:02

Just o let you know, if there were a problem with your authentication with Google, you would receive message like this:
Code: Select all
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project forge: Unable to commit files
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] svn: Commit failed (details follow):
[ERROR] svn: MKACTIVITY of '/svn/!svn/act/995dddf5-f489-4d34-a77d-35bf02a34e78': authorization failed: Could not authenticate to server: rejected Basic challenge (https://cardforge.googlecode.com)
jendave
 
Posts: 307
Joined: 01 Jun 2008, 07:19
Has thanked: 8 times
Been thanked: 21 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 30 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 30 users online :: 0 registered, 0 hidden and 30 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 30 guests

Login Form