jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven Shared Components
  • MSHARED-35

Recreating pom.properties always breaks the archivers uptodate check

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: maven-archiver
  • Labels:
    None
  • Testcase included:
    yes

Description

The maven-archiver creates a file called pom.properties on every invocation. (Unless the flag "addMavenDescriptor" is set to false, which few people do.) This forced recreation makes the uptodate check fail. In other words, jar files are always recreated, regardless whether anything was recompiled. Obviously, this makes the uptodate check of war files etc. fail as well, because the included jar files are always changed.. This is a major drawback, because it makes Maven much slower than, for example, Ant-.

The attached patch proposes a solution for the same problem. What the patch does:

  • It is obviously bad, that the generated pom.properties file is in the projects directory. The
    patch moves the file to ${project.build.directory}/maven-archiver, which seems to me to
    be a more sensible solution.
  • Second, whether we like it or not, there are projects, which create multiple artifacts. In other
    words, it isn't good to have a single file. The patch renames the pom.properties file to
    ${groupId}/$artifactFinalName.properties. Hopefully, this is sufficiently unique.
  • Finally, the patch makes the maven-archiver check, whether the pom.properties file has
    actually changed. (In other words, whether groupId, artifactId, or version have changed.)
    It does so, by writing the file to an internal buffer and comparing the file on the disk and
    the internal buffer (after skipping the line with the timestamp).

In other words, in the usual case, where groupId, artifactId and version haven't changed, the pom.properties file remains unchanged. In particular, the jar file doesn't need to be recreated.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    maven-archiver-MNG2854-4.patch
    15/May/07 3:17 PM
    11 kB
    Jochen Wiedmann
  2. Text File
    maven-archiver-properties.patch
    03/Mar/07 3:36 PM
    6 kB
    Jochen Wiedmann
  3. Text File
    maven-archiver-properties-2.patch
    22/Mar/07 3:25 PM
    14 kB
    Jochen Wiedmann
  4. Text File
    maven-archiver-properties-3.patch
    28/Apr/07 2:19 PM
    10 kB
    Jochen Wiedmann

Issue Links

depends upon

Bug - A problem which impairs or prevents the functions of the product. MNG-2301 Maven Archiver deleteing already existing pom.properties file.

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
is depended upon by

Improvement - An improvement or enhancement to an existing feature or task. MJAR-74 Upgrade maven-archiver dependency to 2.3-SNAPSHOT

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Jochen Wiedmann added a comment - 03/Mar/07 3:39 PM

Possible duplicate

Show
Jochen Wiedmann added a comment - 03/Mar/07 3:39 PM Possible duplicate
Hide
Permalink
Jason van Zyl added a comment - 22/Mar/07 9:42 AM

Point one is fine.

Point two is not fine. One artifact and so many people expect the pom.properties file and is what we document. That can't change and I will never support the widespread production of multiple artifacts.

Point three is fine.

Fix up the second point and I will apply the patch. Also, how did you test this?

Show
Jason van Zyl added a comment - 22/Mar/07 9:42 AM Point one is fine. Point two is not fine. One artifact and so many people expect the pom.properties file and is what we document. That can't change and I will never support the widespread production of multiple artifacts. Point three is fine. Fix up the second point and I will apply the patch. Also, how did you test this?
Hide
Permalink
Jochen Wiedmann added a comment - 22/Mar/07 3:25 PM

Ok, here's an updated version of the patch. Note, that it contains a test case (MavenArchiverTest.testRecreation) that verifies whether the jar file is indeed created when invoked for the first time, but isn't for the second time.

Show
Jochen Wiedmann added a comment - 22/Mar/07 3:25 PM Ok, here's an updated version of the patch. Note, that it contains a test case (MavenArchiverTest.testRecreation) that verifies whether the jar file is indeed created when invoked for the first time, but isn't for the second time.
Hide
Permalink
Trygve Laugstol added a comment - 26/Apr/07 8:19 AM

A couple of code comments:

  • Call the class PomPropertiesUtil instead of Manager. There are a lot of other Manager classes in Maven and they are Plexus components, while this is a normal utility class.
  • Use org.codehaus.plexus.util.IOUtil.close() to close streams.
  • When comparing the properties file why not generate Properties object and load the existing properties file and use Properties.equals()? That should save you some hassle.
Show
Trygve Laugstol added a comment - 26/Apr/07 8:19 AM A couple of code comments:
  • Call the class PomPropertiesUtil instead of Manager. There are a lot of other Manager classes in Maven and they are Plexus components, while this is a normal utility class.
  • Use org.codehaus.plexus.util.IOUtil.close() to close streams.
  • When comparing the properties file why not generate Properties object and load the existing properties file and use Properties.equals()? That should save you some hassle.
Hide
Permalink
Jochen Wiedmann added a comment - 28/Apr/07 2:19 PM

Done.

Thanks for the hint regarding Properties.equals(...). One learns all the time. Of course, this simplifies the code drastically.

Show
Jochen Wiedmann added a comment - 28/Apr/07 2:19 PM Done. Thanks for the hint regarding Properties.equals(...). One learns all the time. Of course, this simplifies the code drastically.
Hide
Permalink
Carlos Sanchez added a comment - 15/May/07 3:09 PM

Please add the apache license to PomPropertiesUtil.java if you grant the license to the ASF

Show
Carlos Sanchez added a comment - 15/May/07 3:09 PM Please add the apache license to PomPropertiesUtil.java if you grant the license to the ASF
Hide
Permalink
Jochen Wiedmann added a comment - 15/May/07 3:17 PM

Done.

Show
Jochen Wiedmann added a comment - 15/May/07 3:17 PM Done.
Hide
Permalink
Carlos Sanchez added a comment - 15/May/07 3:24 PM

Applied in 2.3-SNAPSHOT

Show
Carlos Sanchez added a comment - 15/May/07 3:24 PM Applied in 2.3-SNAPSHOT

People

  • Assignee:
    Carlos Sanchez
    Reporter:
    Jochen Wiedmann
Vote (5)
Watch (5)

Dates

  • Created:
    03/Mar/07 3:36 PM
    Updated:
    20/Dec/08 12:19 PM
    Resolved:
    15/May/07 3:24 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.