[ 
http://jira.codehaus.org/browse/MOJO-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=203259#action_203259
 ] 

Peter Lynch commented on MOJO-1478:
-----------------------------------

This may be a Mac OSX, jdk 1.6(64bit) specific issue. 

I have tested my proposed fix in various configs for a few hours on this 
platform.

Using Java version: 1.6
Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
Java version: 1.6.0_17
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.5.8" arch: "x86_64" Family: "mac"

In my local Maven project I captured the cmd line mvn a-m-p was using and put 
that in a shell script. I ran the shell script against my project sources and 
reproduced the error, bypassing the a-m-p plugin.

Then I changed -s to -d ONLY in the shell script and it worked fine.

I looked at what Ant's apt task does. It just uses -d and no -s if you just 
specify the 'destdir', even with no compile. Since I am converting a working 
Ant script to Maven, this was easy to verify that the Ant <apt> call was 
working fine with just -d.

So at this point I submitted my first patch.

Just to make sure I captured the cmd line that Ant was using and put that in a 
shell script. To my surprise that failed putting the sources into the correct 
dir.??

Now I also noted that Ant's apt task ALWAYS FORKS for what appear to be 
classpath reasons. Just for kicks I tried configing the a.m.p to fork, but it 
still did not output the source files to target/generated-soruces/apt, instead 
to project root. I am not seeing any classpath issues anyways...

So, I ran the integration tests to an unaltered trunk of a-m-p, and they all 
passed. When I applied the patch provided, changing -s to -d in 
AbstractAptMojo.java, 16 of 18 tests failed! You guessed it, the MainClass.txt 
and TestClass.txt got output in the target/test-classes/projects/apt-basic-test 
etc. so the tests failed cause they could not be found in 
target/generated-sources/apt.

Finally I took a chance and added both -d and -s arguments inside the 
AbstractAptMojo.java. When running the tests this time, they all passed.

And for good measure I used the snapshot version with these changes on my 
original maven project that was failing and finally - it worked.

So what I am left with is no explanation as to why it works, other than it just 
does - and hopefully if someone can verify that inetegration tests do not fail 
on other platforms with this patch.

See new patch attached that passes both options.





> apt -s does not work reliably, should be -d
> -------------------------------------------
>
>                 Key: MOJO-1478
>                 URL: http://jira.codehaus.org/browse/MOJO-1478
>             Project: Mojo
>          Issue Type: Bug
>          Components: apt
>         Environment: Mac OSX, JDK 1.6, mvn 2.2.1, apt-maven-plugin 1.0-alpha-3
>            Reporter: Peter Lynch
>         Attachments: MOJO-1478.patch, outputdir.patch
>
>
> setting the outputDirectory on the apt config causes it to be passed to apt 
> executable using the '-s' option.
> Unfortunately this does not work. Instead sources get put in the directory 
> where mvn is launched.
> Comparing this behavior with the way Ant invokes apt shows that Ant uses '-d' 
> option in all cases, whether compiling or not - and it works so a similar 
> change to apt-maven-plugin would seem very safe and cause it to work as 
> documented and  described.
> Attached is a patch which fixes this.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to