maven-gae-plugin/maven-gae-plugin — Issue #8: gae:unpack behavior is unintuitive when ~/.m2/settings.xml has specified ${gae.home}
Author: fredsa
Created: 2011-12-02 06:28:22+00:00
State: open

I think two changes to the gae:unpack behavior are in order to make to address certain configurations.

Here's the use case:

1. Initially I decided to define gae.version and gae.home in ~/.m2/settings.xml using:
1.6.0
/path/to/my/downloaded/appengine-java-sdk-${gae.version}/

2. I later decided that I wanted maven to handle the appengine-java.-sdk downloads, so I tried:
mvn gae:unpack

3. The console output from this goal was surprising:
Downloading: http://repo1.maven.org/maven2/com/google/appengine/appengine-java-sdk/1.6.0/appengine-java-sdk-1.6.0.zip
Downloaded: http://repo1.maven.org/maven2/com/google/appengine/appengine-java-sdk/1.6.0/appengine-java-sdk-1.6.0.zip (47702 KB at 11486.0 KB/sec)
[INFO] Found appengine-java-sdk 1.6.0.

4. Moreover, this directory was *not* created:
.m2/repository/com/google/appengine/appengine-java-sdk/1.6.0/appengine-java-sdk-1.6.0/

5. I ended up digging into the UnpackGoal.java source to figure out what was going on.
https://github.com/maven-gae-plugin/maven-gae-plugin/blob/master/maven-gae-plugin/src/main/java/net/kindleit/gae/UnpackGoal.java#L107

Here are the two issues:

A) It would be great if the log message in line 120 had included the location of sdkDestination, because that make it lot easier to diagnose the next issue

B) Currently the execute() method sort of assumes that sdkDir is the default value: ${settings.localRepository}/com/google/appengine/appengine-java-sdk/${gae.version}/appengine-java-sdk-${gae.version}

To clarify issue B, please consider the output in step 3 more closely. Note that the code first resolves the artifact (downloading it), but then makes no attempt to extract the contents because sdkDir (due to gae.home) is set.

Concrete proposed changes:
I) Move lines 112-117 into the else block (=lines 121-129)
II) Modify the log message in line 120 to include the full path of sdkDestination
II) Perhaps, prior to line 112, check to see if sdkDir is set to a non-default location. If it is, warn the user, ask them to unset the value, point them at settings.xml and abort