PicoContainer
  1. PicoContainer
  2. PICO-145

Improve dependency consistency and simplify them

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      4

      Description

      Now that pico/nano has one build system and has a lot of dependencies
      between the subprojects itself, it is a tedious task to keep the version info
      in the dependency up-to-date and for foreign libs consistent used by more
      than one project.

      Proposal:
      Use entities in the project.xml to ease maintenance and ensure
      consistency. I use this in an own Maven based project with success. See
      following diff for some project.xml files:

      ====== snip ======
      Index: picocontainer/project.xml
      ===================================================================
      RCS file: /cvsroot/picocontainer/java/picocontainer/project.xml,v
      retrieving revision 1.60
      diff -u -r1.60 project.xml
      — picocontainer/project.xml 10 Feb 2004 07:33:40 -0000 1.60
      +++ picocontainer/project.xml 20 Feb 2004 22:50:00 -0000
      @@ -4,6 +4,8 @@
      <!ENTITY eacute "é">
      <!ENTITY oslash "ø">
      <!ENTITY ouml "ö">
      +
      + <!ENTITY dep-jmock SYSTEM "../build-system/dependency/jmock.ent">
      ]>

      <project xmlns:j="jelly:core" xmlns:ant="jelly:ant">
      @@ -138,10 +140,7 @@
      <dependencies>

      <!-- test time only -->

      • <dependency>
      • <id>jmock</id>
      • <version>SNAPSHOT</version>
      • </dependency>
        + &dep-jmock;

      </dependencies>

      @@ -222,13 +221,6 @@
      <name>Matt Ho</name>
      </contributor>
      </contributors>
      -

      • <dependemcies>
      • <dependency>
      • <id>junit</id>
      • <version>3.8.1</version>
      • </dependency>
      • </dependemcies>

      <build>
      <sourceDirectory>$

      {basedir}/src/java</sourceDirectory>
      Index: pool/project.xml
      ===================================================================
      RCS file: /cvsroot/picocontainer/java/pool/project.xml,v
      retrieving revision 1.7
      diff -u -r1.7 project.xml
      — pool/project.xml 8 Feb 2004 20:10:52 -0000 1.7
      +++ pool/project.xml 20 Feb 2004 22:50:00 -0000
      @@ -1,4 +1,8 @@
      <?xml version="1.0" encoding="UTF-8"?>
      +<!DOCTYPE project [
      + <!ENTITY dep-picocontainer SYSTEM "../build-system/dependency/picocontainer.ent">
      + <!ENTITY dep-nanocontainer-testmodel SYSTEM "../build-system/dependency/nanocontainer-testmodel.ent">
      +]>

      <project>
      <extend>${basedir}

      /../project.xml</extend>
      @@ -10,17 +14,9 @@

      <dependencies>

      • <dependency>
      • <id>picocontainer</id>
      • <version>1.0-beta-5-SNAPSHOT</version>
      • <url>http://www.picocontainer.org/</url>
      • </dependency>
        + &dep-picocontainer;
        + &dep-nanocontainer-testmodel;
      • <dependency>
      • <groupId>nanocontainer</groupId>
      • <artifactId>nanocontainer-testmodel</artifactId>
      • <version>1.0-alpha-1-SNAPSHOT</version>
      • </dependency>
        </dependencies>

      </project>
      ====== snap ======

      The entities for the dependencies are now located in a top-level directory build-system/dependency:

      build-system/dependency/jmock.ent
      build-system/dependency/nanocontainer-testmodel.ent
      build-system/dependency/picocontainer.ent

      This will make new releases much easier, just change the entity for the picocontainer and any subproject uses the right version.

      1. build-system.tar.gz
        1 kB
        Jörg Schaible
      2. locator.tar.gz
        0.2 kB
        Jörg Schaible
      3. picocontainer.project.xml.2.diff
        6 kB
        Jörg Schaible
      4. picocontainer.project.xml.diff
        6 kB
        Jörg Schaible

        Activity

        Hide
        Aslak Hellesøy added a comment -

        May you attach a new patch please? JIRA has munged this one (indentation).

        Show
        Aslak Hellesøy added a comment - May you attach a new patch please? JIRA has munged this one (indentation).
        Hide
        Jörg Schaible added a comment -

        Hi Aslak,

        not attaching a patch was intented, because it is some work and introduces some kind of design desicion for the building system. Therefore I only pasted the diff to give an impression, what I would like to do, but I wanted to here first if this would be welcome!

        Regards,
        Jörg

        Show
        Jörg Schaible added a comment - Hi Aslak, not attaching a patch was intented, because it is some work and introduces some kind of design desicion for the building system. Therefore I only pasted the diff to give an impression, what I would like to do, but I wanted to here first if this would be welcome! Regards, Jörg
        Hide
        Jörg Schaible added a comment -

        Aslak, Paul,

        can you comment on this proposed change? Is it welcome?

        Regards,
        Jörg

        Show
        Jörg Schaible added a comment - Aslak, Paul, can you comment on this proposed change? Is it welcome? Regards, Jörg
        Hide
        Aslak Hellesøy added a comment -

        I think it is a great idea, and would be most welcome as a patch.

        Show
        Aslak Hellesøy added a comment - I think it is a great idea, and would be most welcome as a patch.
        Hide
        Jörg Schaible added a comment -

        build-system.tar.gz

        The core files in the new build-system directory.

        Show
        Jörg Schaible added a comment - build-system.tar.gz The core files in the new build-system directory.
        Jörg Schaible made changes -
        Field Original Value New Value
        Attachment build-system.tar.gz [ 11522 ]
        Hide
        Jörg Schaible added a comment -

        picocontainer/project.xml.diff

        The patch upgrading the project.xml of picocontainer to the entity-based build-system.

        Show
        Jörg Schaible added a comment - picocontainer/project.xml.diff The patch upgrading the project.xml of picocontainer to the entity-based build-system.
        Jörg Schaible made changes -
        Attachment picocontainer.project.xml.diff [ 11523 ]
        Hide
        Jörg Schaible added a comment -

        Hi Aslak,

        my implementation got more radical than I thought myself

        Since it is quite some work, I've started now with picocontainer first.
        I have attached an archive that contains all the entity files and a patch for picocontainer/project.xml. I have verified that the global and local build works fine and also the local site generation for picocontainer. The entity files are located in a directory build-system (as sibling to the component's directories). If you don't like the name, just put them elsewhere at a general place and adjust the reference at the top of the new picocontainer/project.xml.

        At a later stage, this build-system directory may also contain common goals for the maven.xml's (also shared by entities). At the office I have realized a goal, that supports a global project.properties file for maven's multiproject plugin.

        Please have a look, I will continue with the other project.xml's if you like it and apply it. IMHO this will make it very easy to share data between all those maven files and keep dpeendencies and versions consistent.

        Regards,
        Jörg

        Show
        Jörg Schaible added a comment - Hi Aslak, my implementation got more radical than I thought myself Since it is quite some work, I've started now with picocontainer first. I have attached an archive that contains all the entity files and a patch for picocontainer/project.xml. I have verified that the global and local build works fine and also the local site generation for picocontainer. The entity files are located in a directory build-system (as sibling to the component's directories). If you don't like the name, just put them elsewhere at a general place and adjust the reference at the top of the new picocontainer/project.xml. At a later stage, this build-system directory may also contain common goals for the maven.xml's (also shared by entities). At the office I have realized a goal, that supports a global project.properties file for maven's multiproject plugin. Please have a look, I will continue with the other project.xml's if you like it and apply it. IMHO this will make it very easy to share data between all those maven files and keep dpeendencies and versions consistent. Regards, Jörg
        Hide
        Jörg Schaible added a comment -

        Hi Alsak,

        unfotunately the build was only successful for Linux, but not in Windows, since it does not resolve entity file references in the same way. I had to introduce an entity locator that references the proper entity location in each directory. The global locator and the one for picocontainer is included here in the attached archive. Please unpack it also in the java basedir and add the locator ent files to CVS. Additionally if you want to change the name of the build-system directory, you have to edit the locator files now.

        Show
        Jörg Schaible added a comment - Hi Alsak, unfotunately the build was only successful for Linux, but not in Windows, since it does not resolve entity file references in the same way. I had to introduce an entity locator that references the proper entity location in each directory. The global locator and the one for picocontainer is included here in the attached archive. Please unpack it also in the java basedir and add the locator ent files to CVS. Additionally if you want to change the name of the build-system directory, you have to edit the locator files now.
        Jörg Schaible made changes -
        Attachment locator.tar.gz [ 11524 ]
        Hide
        Jörg Schaible added a comment -

        picocontainer/project.xml.2.diff

        New version of the patch using the entitiy locator now.

        Show
        Jörg Schaible added a comment - picocontainer/project.xml.2.diff New version of the patch using the entitiy locator now.
        Jörg Schaible made changes -
        Attachment picocontainer.project.xml.2.diff [ 11525 ]
        Aslak Hellesøy made changes -
        Assignee Joerg Schaible [ joehni ]
        Jörg Schaible made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Jörg Schaible logged work - 15/Mar/04 6:00 PM
        • Time Spent:
          2 hours
           
          Setup directory build-system with entity definitions.
          Converted project.xml of picocontainer for new system.
        Jörg Schaible made changes -
        Time Spent 2 hours [ 7200 ]
        Remaining Estimate 2 hours [ 7200 ] 6 hours [ 21600 ]
        Hide
        Paul Hammant added a comment -

        I'm not sure this is really needed. I myself would open TextPad, FindInFiles 3.8.1, OpenAll, change (one by one), SaveAll, build from root.

        I think leaving it the way it is means we don't lose a percentage more users just because one more thing is cryptic.

        A case of just because we can does not mean we should.

        Opinions?

        Show
        Paul Hammant added a comment - I'm not sure this is really needed. I myself would open TextPad, FindInFiles 3.8.1, OpenAll, change (one by one), SaveAll, build from root. I think leaving it the way it is means we don't lose a percentage more users just because one more thing is cryptic. A case of just because we can does not mean we should. Opinions?
        Jörg Schaible logged work - 16/Mar/04 1:01 AM
        • Time Spent:
          2 hours
           
          Use entities in type3msg, testmodel, pool, pool2, picometer
        Jörg Schaible made changes -
        Remaining Estimate 6 hours [ 21600 ] 4 hours [ 14400 ]
        Time Spent 2 hours [ 7200 ] 4 hours [ 14400 ]
        Hide
        Jörg Schaible added a comment -

        Sorry, Paul, did see your comment on this issue here too late. I'll stop now as requested, that you can make up your mind.

        Show
        Jörg Schaible added a comment - Sorry, Paul, did see your comment on this issue here too late. I'll stop now as requested, that you can make up your mind.
        Hide
        Jörg Schaible added a comment -

        Well, see youself. We have four references for commons-logging in our POMs. What do you think how many different versions we refer? I count three!

        Show
        Jörg Schaible added a comment - Well, see youself. We have four references for commons-logging in our POMs. What do you think how many different versions we refer? I count three!
        Hide
        Aslak Hellesøy added a comment -

        I just experienced a problem with this. When going down to a subproject, say servlet, and try to build, I get:

        C:\scm\picocontainer\java\servlet>maven -o
        __ __

        \/ __ Apache_ ___
          \/ / ` \ V / -) ' \ ~ intelligent projects ~
        _   _,_ _/___ _ _ v. 1.0-rc1-SNAPSHOT

        java.io.FileNotFoundException: locator.ent (The system cannot find the file specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:69)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:156)
        at java.net.URL.openStream(URL.java:913)
        at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
        at org.apache.xerces.impl.XMLDTDScannerImpl.startPE(Unknown Source)
        at org.apache.xerces.impl.XMLDTDScannerImpl.skipSeparator(Unknown Source)
        at org.apache.xerces.impl.XMLDTDScannerImpl.scanDecls(Unknown Source)
        at org.apache.xerces.impl.XMLDTDScannerImpl.scanDTDInternalSubset(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1527)
        at org.apache.maven.MavenUtils.getProject(MavenUtils.java:224)
        at org.apache.maven.MavenUtils.getProject(MavenUtils.java:161)
        at org.apache.maven.MavenSession.initializeRootProject(MavenSession.java:324)
        at org.apache.maven.MavenSession.initialize(MavenSession.java:234)
        at org.apache.maven.cli.App.doMain(App.java:532)
        at org.apache.maven.cli.App.main(App.java:1109)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at com.werken.forehead.Forehead.run(Forehead.java:551)
        at com.werken.forehead.Forehead.main(Forehead.java:581)

        (because the relative path to the .ent files is now different). It looks like this externalising of dependencies might be causing more harm than good. And I second Paul's comment: a global search and replace with a decent text editor can do the trick too.

        Show
        Aslak Hellesøy added a comment - I just experienced a problem with this. When going down to a subproject, say servlet, and try to build, I get: C:\scm\picocontainer\java\servlet>maven -o __ __ \/ __ Apache _ ___   \/ / ` \ V / - ) ' \ ~ intelligent projects ~ _   _ ,_ _/___ _ _ v. 1.0-rc1-SNAPSHOT java.io.FileNotFoundException: locator.ent (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at java.io.FileInputStream.<init>(FileInputStream.java:66) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:69) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:156) at java.net.URL.openStream(URL.java:913) at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source) at org.apache.xerces.impl.XMLDTDScannerImpl.startPE(Unknown Source) at org.apache.xerces.impl.XMLDTDScannerImpl.skipSeparator(Unknown Source) at org.apache.xerces.impl.XMLDTDScannerImpl.scanDecls(Unknown Source) at org.apache.xerces.impl.XMLDTDScannerImpl.scanDTDInternalSubset(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1527) at org.apache.maven.MavenUtils.getProject(MavenUtils.java:224) at org.apache.maven.MavenUtils.getProject(MavenUtils.java:161) at org.apache.maven.MavenSession.initializeRootProject(MavenSession.java:324) at org.apache.maven.MavenSession.initialize(MavenSession.java:234) at org.apache.maven.cli.App.doMain(App.java:532) at org.apache.maven.cli.App.main(App.java:1109) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.werken.forehead.Forehead.run(Forehead.java:551) at com.werken.forehead.Forehead.main(Forehead.java:581) (because the relative path to the .ent files is now different). It looks like this externalising of dependencies might be causing more harm than good. And I second Paul's comment: a global search and replace with a decent text editor can do the trick too.
        Hide
        Jörg Schaible added a comment -

        Hello Aslak and Paul,

        the problem above arose, since I already used entities in the global POM, although not all POMs were converted. I reverted the changes for this file, so nobody is disturbed.

        I am aware that these changes are a little different from the normal usage, therefore I've asked. Since I don't want to make a big issue out of this, I just summarize pros and cons:

        Pros:

        • Maven has limits if you have a multiproject with a lot of subprojects depending on various other libraries. Entites help to keep their versions in sync, but without introducing a dependency for all (no POM inheritance wanted here). We already have the issue for commons-logging.
        • Upgrading for a dependency is a change in a single file and less error-phrone (grep for jar and version is currently not possible)
        • By managing the version of the subprojects with dependencies the release of the projects is a change in a single file
        • Entities help to reduce redundancy massivly (normally wanted)
        • Global project information is not scattered in all subprojects
        • Information in POMs is more clearly arranged (have a look at pool's picocontainer's current POM)
        • Normal Maven usage is exactly the same, so not even users building the project must care

        Cons:

        • Unusual, developers have to get used to it and building errors may arise at another stage

        Anything else?

        So we can:

        • revert anything immediately
        • finalize it, give it a try and decide in two or three weeks to revert or not (so you have the possibility to get used to it)
        • finalize and keep it

        Take your choise, you rule

        Show
        Jörg Schaible added a comment - Hello Aslak and Paul, the problem above arose, since I already used entities in the global POM, although not all POMs were converted. I reverted the changes for this file, so nobody is disturbed. I am aware that these changes are a little different from the normal usage, therefore I've asked. Since I don't want to make a big issue out of this, I just summarize pros and cons: Pros: Maven has limits if you have a multiproject with a lot of subprojects depending on various other libraries. Entites help to keep their versions in sync, but without introducing a dependency for all (no POM inheritance wanted here). We already have the issue for commons-logging. Upgrading for a dependency is a change in a single file and less error-phrone (grep for jar and version is currently not possible) By managing the version of the subprojects with dependencies the release of the projects is a change in a single file Entities help to reduce redundancy massivly (normally wanted) Global project information is not scattered in all subprojects Information in POMs is more clearly arranged (have a look at pool's picocontainer's current POM) Normal Maven usage is exactly the same, so not even users building the project must care Cons: Unusual, developers have to get used to it and building errors may arise at another stage Anything else? So we can: revert anything immediately finalize it, give it a try and decide in two or three weeks to revert or not (so you have the possibility to get used to it) finalize and keep it Take your choise, you rule
        Hide
        Jörg Schaible added a comment -

        Paul, Aslak,

        did you make up your mind concerning this issue?
        See our options in the last comment on JIRA.

        A complete description is available in Maven's wiki at: http://wiki.codehaus.org/maven/EnsureProjectConsistencyWithEntities

        We currently have 6 projects with the entity technique in CVS and I personally do not like the mixture.

        Regards,
        Jörg

        Show
        Jörg Schaible added a comment - Paul, Aslak, did you make up your mind concerning this issue? See our options in the last comment on JIRA. A complete description is available in Maven's wiki at: http://wiki.codehaus.org/maven/EnsureProjectConsistencyWithEntities We currently have 6 projects with the entity technique in CVS and I personally do not like the mixture. Regards, Jörg
        Hide
        Aslak Hellesøy added a comment -

        Please roll it back to the way it was before. Using entities is problematic because:

        1) It makes it impossible (AFAICT) to build individual subprojects separately

        2) It creates more confusion and makes the build system harder to understand (Maven is hard enough already).

        The problem that entities is solving can also be solved with a simple text editor that supports search/replace over multiple files.

        Show
        Aslak Hellesøy added a comment - Please roll it back to the way it was before. Using entities is problematic because: 1) It makes it impossible (AFAICT) to build individual subprojects separately 2) It creates more confusion and makes the build system harder to understand (Maven is hard enough already). The problem that entities is solving can also be solved with a simple text editor that supports search/replace over multiple files.
        Jörg Schaible made changes -
        Status In Progress [ 3 ] Open [ 1 ]
        Hide
        Jörg Schaible added a comment -

        Changes reverted.

        Show
        Jörg Schaible added a comment - Changes reverted.
        Jörg Schaible made changes -
        Resolution Won't Fix [ 2 ]
        Status Open [ 1 ] Closed [ 6 ]

          People

          • Assignee:
            Jörg Schaible
            Reporter:
            Jörg Schaible
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 2 hours Original Estimate - 2 hours
              2h
              Remaining:
              Time Spent - 4 hours Remaining Estimate - 4 hours
              4h
              Logged:
              Time Spent - 4 hours Remaining Estimate - 4 hours
              4h