History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CC-438
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jeffrey Fredrick
Reporter: Dan Rollo
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
CruiseControl

Maven2 Snapshot Dependency source control plugin.

Created: 30/Mar/06 11:39 PM   Updated: 23/Apr/06 09:56 AM
Component/s: Core Application
Affects Version/s: 2.4.1
Fix Version/s: 2.5

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: 1. File CC-438.diff (5 kb)
2. Zip Archive CC-438.zip (1.20 Mb)

Environment: All


 Description  « Hide
The attached patch/files provide a Maven2 Snapshot Dependency source control plugin.

The main known limitation is you can't yet override the default value for the Local Repository location.
This issue with the MavenEmbedder has been confirmed by the Maven project and should be fixed in a future release.
Until that time, I've left the localRepository accessor as "package-private". The updated configxml.html also mentions this issue.

Files changed:
docs/configxml.html - added <maven2snapshotdependency> doc
src/net/sourceforge/cruisecontrol/default-plugins.properties - added maven2snapshotdependency plugin

New Files:
src/net/sourceforge/cruisecontrol/sourcecontrols/Maven2SnapshotDependency.java
test/net/sourceforge/cruisecontrol/sourcecontrols/Maven2SnapshotDependencyTest.java
test/net/sourceforge/cruisecontrol/sourcecontrols/maven2-pom.xml

New Directory and File for test repo:
test/net/sourceforge/cruisecontrol/sourcecontrols/maven2repo/ccdeptest/cc-maven-test/1.0-SNAPSHOT/
test/net/sourceforge/cruisecontrol/sourcecontrols/maven2repo/ccdeptest/cc-maven-test/1.0-SNAPSHOT/cc-maven-test-1.0-SNAPSHOT.jar

New library:
lib/maven-embedder-2.0.3-dep.jar


Dan Rollo

 All   Comments   Work Log   Change History      Sort Order:
Jerome Lacoste [17/Apr/06 11:44 AM]
- the cruisecontrol start scripts need to be updated as well (.sh is clearly not, haven't looked at .bat)
- I may have spotted an issue with the doc: the pomfile argument in the config.xml is it seems named projectfile

Dan Rollo [17/Apr/06 10:52 PM]
Augh! CVS not allowing logins again....

Below are corrections for the issues Jerome found (in case a committer is trying to apply this patch before CVS behaves again)

change configxml.html, line 3368 from:

<td>projectFile</td>
to:
               <td>pomfile</td>


cruisecontrol.bat, line 74 from:

set CRUISE_PATH=%CRUISE_PATH%;%DISTDIR%\cruisecontrol.jar;%LIBDIR%\log4j.jar;%LIBDIR%\jdom.jar;%LIBDIR%\ant\ant.jar;%LIBDIR%\ant\ant-launcher.jar;%LIBDIR%\xercesImpl-2.7.0.jar;%LIBDIR%\xml-apis-2.7.0.jar;%LIBDIR%\xmlrpc-2.0.1.jar;%LIBDIR%\xalan-2.6.0.jar;%LIBDIR%\jakarta-oro-2.0.3.jar;%LIBDIR%\mail.jar;%LIBDIR%\junit.jar;%LIBDIR%\activation.jar;%LIBDIR%\commons-net-1.1.0.jar;%LIBDIR%\starteam-sdk.jar;%LIBDIR%\mx4j.jar;%LIBDIR%\mx4j-tools.jar;%LIBDIR%\mx4j-remote.jar;%LIBDIR%\smack.jar;%LIBDIR%\comm.jar;%LIBDIR%\x10.jar;%LIBDIR%\fast-md5.jar;.

to:

set CRUISE_PATH=%CRUISE_PATH%;%DISTDIR%\cruisecontrol.jar;%LIBDIR%\log4j.jar;%LIBDIR%\jdom.jar;%LIBDIR%\ant\ant.jar;%LIBDIR%\ant\ant-launcher.jar;%LIBDIR%\xercesImpl-2.7.0.jar;%LIBDIR%\xml-apis-2.7.0.jar;%LIBDIR%\xmlrpc-2.0.1.jar;%LIBDIR%\xalan-2.6.0.jar;%LIBDIR%\jakarta-oro-2.0.3.jar;%LIBDIR%\mail.jar;%LIBDIR%\junit.jar;%LIBDIR%\activation.jar;%LIBDIR%\commons-net-1.1.0.jar;%LIBDIR%\starteam-sdk.jar;%LIBDIR%\mx4j.jar;%LIBDIR%\mx4j-tools.jar;%LIBDIR%\mx4j-remote.jar;%LIBDIR%\smack.jar;$LIBDIR/maven-embedder-2.0.3-dep.jar;%LIBDIR%\comm.jar;%LIBDIR%\x10.jar;%LIBDIR%\fast-md5.jar;.


cruisecontrol.sh, line 76 from:

CRUISE_PATH=$JAVA_HOME/lib/tools.jar:$DISTDIR/cruisecontrol.jar:$LIBDIR/log4j.jar:$LIBDIR/jdom.jar:$LIBDIR/ant/ant.jar:$LIBDIR/ant/ant-launcher.jar:$LIBDIR/xercesImpl-2.7.0.jar:$LIBDIR/xml-apis-2.7.0.jar:$LIBDIR/xmlrpc-2.0.1.jar:$LIBDIR/xalan-2.6.0.jar:$LIBDIR/jakarta-oro-2.0.3.jar:$LIBDIR/mail.jar:$LIBDIR/junit.jar:$LIBDIR/activation.jar:$LIBDIR/commons-net-1.1.0.jar:$LIBDIR/starteam-sdk.jar:$LIBDIR/mx4j.jar:$LIBDIR/mx4j-tools.jar:$LIBDIR/mx4j-remote.jar:$LIBDIR/smack.jar:$LIBDIR/comm.jar:$LIBDIR/x10.jar:$LIBDIR/fast-md5.jar:.

to:

CRUISE_PATH=$JAVA_HOME/lib/tools.jar:$DISTDIR/cruisecontrol.jar:$LIBDIR/log4j.jar:$LIBDIR/jdom.jar:$LIBDIR/ant/ant.jar:$LIBDIR/ant/ant-launcher.jar:$LIBDIR/xercesImpl-2.7.0.jar:$LIBDIR/xml-apis-2.7.0.jar:$LIBDIR/xmlrpc-2.0.1.jar:$LIBDIR/xalan-2.6.0.jar:$LIBDIR/jakarta-oro-2.0.3.jar:$LIBDIR/mail.jar:$LIBDIR/junit.jar:$LIBDIR/activation.jar:$LIBDIR/commons-net-1.1.0.jar:$LIBDIR/starteam-sdk.jar:$LIBDIR/mx4j.jar:$LIBDIR/mx4j-tools.jar:$LIBDIR/mx4j-remote.jar:$LIBDIR/smack.jar:$LIBDIR/maven-embedder-2.0.3-dep.jar:$LIBDIR/comm.jar:$LIBDIR/x10.jar:$LIBDIR/fast-md5.jar:.

(Just added "$LIBDIR/maven-embedder-2.0.3-dep.jar", though we should really use v2.0.4 now that it's released - which also means using that version of the jar - instead of the one I posted).

The same additions should be made the to cruisecontrol.bat/.sh scripts in the contrib/distributed dir. (In fact, that's why I missed the script changes - I've been running using CCDist. ;)

Finally, I'd like to add some more debugging output as suggested by Jerome, but w/ CVS down, here's some minimal changes - to be applied after the existing patch...subversion is really sounding good right about now. ;)

Maven2SnapshotDependency.java, line 235, from:

LOG.warn("We should not need this approach to finding artifact files.");

to:

LOG.warn("We should not need this approach to finding artifact files. Artifact: " + artifact);


add at line 433:

LOG.debug("Examining artifact: " + artifact);


add at line 476:

LOG.debug("Manually examining artifact: " + artifact);


add at line 532:

LOG.debug("Checking artifact: " + artifactInfo.getArtifact());


Dan

PS: Jerome, I haven't dug into the "multi-project" question yet.

Dan Rollo [20/Apr/06 08:22 PM]
Augh! CVS is still not letting me in.

BTW, I botched the DOS cruise_path in my prior comment (forgot to convert
$LIBDIR/maven-embedder-2.0.4-dep.jar:
to
%LIBDIR%\maven-embedder-2.0.4-dep.jar;

A couple more fixes:

1. Add at line 223 (a toString() method to inner class ArtifactInfo):

public String toString() {
            return artifact + "," + artifactType + ","
                    + (localRepoFile != null ? localRepoFile.getAbsolutePath() : null);
        }



2. Also, Jerome found some redundant logic. The corrected method at line 334 (after item 1 above is inserted) is:

private static void findParentSnapshotArtifacts(MavenProject projectWithDependencies, List artifactInfos,
                                                    File localRepoBaseDir, MavenEmbedder embedder, File pomFile) {
        // handle parents and grandparents...
        if (projectWithDependencies != null) {

Artifact parentArtifact;
            MavenProject currMvnProject = projectWithDependencies;

while ((parentArtifact = currMvnProject.getParentArtifact()) != null
                    && parentArtifact.isSnapshot()) {

addArtifactInfo(artifactInfos, parentArtifact, ArtifactInfo.ART_TYPE_PARENT, localRepoBaseDir);
                currMvnProject = projectWithDependencies.getParent();
            }

} else {

// couldn't read project, so try to do some stuff manually
            MavenProject mavenProject = null;
            try {
                mavenProject = embedder.readProject(pomFile);
            } catch (ProjectBuildingException e) {
                LOG.error("Failed to read maven2 mavenProject", e);
            }

if (mavenProject != null) {

Artifact artifact;
                MavenProject currMvnProject = mavenProject;

while ((artifact = currMvnProject.getParentArtifact()) != null
                        && (artifact.getVersion().endsWith(Artifact.SNAPSHOT_VERSION) || artifact.isSnapshot())
                        ) {

addArtifactInfo(artifactInfos, artifact, ArtifactInfo.ART_TYPE_PARENT, localRepoBaseDir);

resolveArtifact(embedder, artifact, mavenProject, embedder.getLocalRepository());

currMvnProject = mavenProject.getParent();
                }
            }
        }
    }


Dan (subversion) ;)

Jeffrey Fredrick [23/Apr/06 09:56 AM]
committed.