Proposed Answer Maven build fails to assemble jar because jar is read-only?

  • Wednesday, February 08, 2012 11:50 PM
     
     

    I am using TFS 2010 and the Maven build extension.  I have many working builds in place.  I have a new one however that compiles source code but then fails when it tries to create a jar file.  I have googled my fingers to the bone.  Does anyone have a suggestion?  BTW, I can run a Maven build manually on the build server on top of the source pulled over by TFS, and the manual build works fine.  Also, the jar that is read-only is created by the Maven build.  (And it is read-only when built with TFS and not read-only when built manually.  I checked.)

    [INFO] Scanning for projects...
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Services-Core
    [INFO]    task-segment: [install]
    [INFO] ------------------------------------------------------------------------
    [INFO] [resources:resources {execution: default-resources}]
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 2 resources
    [INFO] [compiler:compile {execution: default-compile}]
    [INFO] Compiling 23 source files to C:\Builds\7\Services-Core\test4\Sources\web\WEB-INF\classes
    [INFO] [resources:testResources {execution: default-testResources}]
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 10 resources
    [INFO] [compiler:testCompile {execution: default-testCompile}]
    [INFO] Not compiling test sources
    [INFO] [surefire:test {execution: default-test}]
    [INFO] Tests are skipped.
    [INFO] [jar:jar {execution: default-jar}]
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Error assembling JAR

    Embedded error: C:\Builds\7\Services-Core\test4\Sources\target\Services-Core-1.0.0.jar is read-only.
    [INFO] ------------------------------------------------------------------------
    [INFO] For more information, run Maven with the -e switch
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3 seconds
    [INFO] Finished at: Wed Feb 08 23:21:35 GMT 2012
    [INFO] Final Memory: 18M/45M
    [INFO] ------------------------------------------------------------------------


    AJ_3



    • Edited by AJ_3 Wednesday, February 08, 2012 11:54 PM
    • Edited by AJ_3 Wednesday, February 08, 2012 11:56 PM
    • Moved by Vicky Song Friday, February 10, 2012 2:41 AM (From:Team Foundation Server - Build Automation)
    •  

All Replies

  • Thursday, February 09, 2012 6:34 PM
     
     

    OK, I have something to add...

    My Team Project name had a hyphen in it.  For want of anything better to do, I modified the POM and removed the hyphen (derived from the project name) from artifactId and name.  Now my jar is writable and my build succeeds.  Explanations are welcome...


    AJ_3


    • Edited by AJ_3 Thursday, February 09, 2012 6:40 PM
    •  
  • Friday, February 10, 2012 2:41 AM
     
     

    Hi AJ_3,

    I am moving your case to the Team Foundation Server - Eclipse and Cross Platform forum so that you can get better support there.

    Thanks.


    Vicky Song [MSFT]
    MSDN Community Support | Feedback to us

  • Monday, February 13, 2012 11:37 AM
    Owner
     
     Proposed Answer

    That is very odd.  Can you try putting the hypen back in and seeing if it stops working again?

    If you hadn't posted back about the hyphen thing then I would have assumed that the Maven targets directory was not being ignored and so the jar file that you are building has been accidentally checked in to TFS.

    But the hyphen thing is confusing me - it doesn't reproduce when I do this locally (I get the same results with and without the hypen)

    Apologies,

    Martin.


    http://www.woodwardweb.com

  • Wednesday, February 15, 2012 9:19 PM
     
     
    I did that right after it started working. (I had trouble believing it myself.) And, after I put the hyphen in, it failed again. I took it out and it succeeded again.   

    AJ_3