...
So how would this feature be implemented? I think that the appropriate file would be a file similar to maven-metadata.xml:. I named it maven-artifact-lifecycle.xml. Here's a sample file for JUnit and please also note the XML schema attached.
| Code Block | ||
|---|---|---|
| ||
<metadata><artifactLifecycle> <groupId>my.group<<groupId>junit</groupId> <artifactId>my-app< <artifactId>junit</artifactId> <versioning> <lifecycleStates> <release>3 <lifecycleState> <versionPattern>3.8.1</release>versionPattern> <versions> <status>approved</status> <version status="deprecated">3.7</version> <projectPatterns> <projectPattern>my.fancy.project.*</projectPattern> <version status="flawed">3.8</version> <version status="mainstream">3.8.1</version> <version status="...">>3.8.2</version> <version>4.0</version> <version>4.1</version> <version>4.2</version> <version>4.3</version> <version>4.3.1</version> <version>4.4</version> </versions> </versioning> </metadata> |
...
</projectPatterns>
</lifecycleState>
</lifecycleStates>
</artifactLifecycle>
|
I wrote a little Maven plugin called maven-assertdepend-plugin which I'm willing to contribute if there is interest. It checks against the information contained in the maven-artifact-lifecycle.xml of each dependency during the validation phase. Here's some sample output:
| No Format |
|---|
jogy@shadowfax:~/projects/assertdependtest> mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Test project for maven-assertdepend-plugin
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [assertdepend:assert-depend {execution: assert-depend}]
[INFO] APPROVED: junit:junit:jar:3.8.1:test
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] DEPRECATED: com.company:util.jar:1.0:compile, comment: Use version
2.1 instead.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Wed Jan 02 22:07:41 CET 2008
[INFO] Final Memory: 4M/7M
[INFO] ------------------------------------------------------------------------
|
And here is some sample output using the warning switch:
| No Format |
|---|
jogy@shadowfax:~/projects/assertdependtest> mvn -Dassertdepend.warn=true install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Test project for maven-assertdepend-plugin
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [assertdepend:assert-depend {execution: assert-depend}]
[INFO] APPROVED: junit:junit:jar:3.8.1:test
[WARNING] DEPRECATED: ch.vrsg.vi:vibase:jar:1.0-SNAPSHOT:compile, comment: Use
version 2.1 instead.
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Surefire report directory:
/Users/jogy/projects/assertdependtest/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.company.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.237 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] [jar:jar]
[INFO] Building jar:
/Users/jogy/projects/assertdependtest/target/assertdependtest-1.0-SNAPSHOT.jar
[INFO] [install:install]
[INFO] Installing
/Users/jogy/projects/assertdependtest/target/assertdependtest-1.0-SNAPSHOT.jar to
/Users/jogy/.m2/repository/ch/adnovum/assertdependtest/1.0-SNAPSHOT/assertdependtest-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11 seconds
[INFO] Finished at: Wed Jan 02 22:08:06 CET 2008
[INFO] Final Memory: 5M/12M
[INFO] ------------------------------------------------------------------------
|
The Archiva subproject would probably be the best place to maintain this information because it supports user roles. Archiva could even check for illegal dependencies.
