Add repository plugin I've been using for audit process
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112987 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
2
repository/.cvsignore
Normal file
2
repository/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
target
|
||||
maven.log
|
||||
194
repository/plugin.jelly
Normal file
194
repository/plugin.jelly
Normal file
@@ -0,0 +1,194 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project
|
||||
xmlns:define="jelly:define"
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:repository="repository"
|
||||
xmlns:u="jelly:util"
|
||||
xmlns:x="jelly:xml">
|
||||
|
||||
<define:taglib uri="repository">
|
||||
|
||||
<!--
|
||||
! tag for executing a command on the remote repo
|
||||
! @param command the command to execute
|
||||
!-->
|
||||
<define:tag name="exec">
|
||||
<exec dir="." executable="${maven.ssh.executable}">
|
||||
<arg line="${maven.repo.central} -l ${maven.username} '${command}'"/>
|
||||
</exec>
|
||||
</define:tag>
|
||||
|
||||
<!--
|
||||
! parse the locally available repository audit file
|
||||
! and make it available to the caller via a variable
|
||||
! @param var the name of the variable
|
||||
!-->
|
||||
<define:tag name="parseAudit">
|
||||
<u:file name="${plugin.resources}/repository-audit.xml" var="auditFile" />
|
||||
<x:parse xml="${auditFile}" var="audit" />
|
||||
<!-- make available to caller -->
|
||||
<j:set var="${var}" scope="parent" value="${audit}"/>
|
||||
</define:tag>
|
||||
|
||||
<!--
|
||||
! copy a local file to the remote repository
|
||||
! @param from the local file to copy
|
||||
! @param toFileOrDir the remote directory or file to copy to
|
||||
!-->
|
||||
<define:tag name="copy">
|
||||
<u:file name="${from}" var="fromFile"/>
|
||||
<echo>Copying '${fromFile.canonicalFile.name}' in '${fromFile.canonicalFile.parent}' to directory '${toFileOrDir}'</echo>
|
||||
<exec dir="${fromFile.canonicalFile.parent}" executable="${maven.scp.executable}">
|
||||
<arg value="${fromFile.canonicalFile.name}"/>
|
||||
<arg value="${maven.username}@${maven.repo.central}:${toFileOrDir}/"/>
|
||||
</exec>
|
||||
</define:tag>
|
||||
|
||||
<!--
|
||||
! copy a license file from a URL the remote repository
|
||||
! @param url the license file to copy
|
||||
! @param groupId the groupId the license is for
|
||||
!-->
|
||||
<define:tag name="copyLicense">
|
||||
<repository:urlFileName url="${url}" var="fileName" />
|
||||
|
||||
<j:set var="localFileName">${systemScope['java.io.tmpdir']}${fileName}</j:set>
|
||||
|
||||
<get src="${url}" dest="${localFileName}"/>
|
||||
|
||||
<!-- copy the license -->
|
||||
<j:set var="directory" value="${maven.repo.central.directory}/${groupId}/licenses/" />
|
||||
<repository:copy from="${localFileName}" toFileOrDir="${directory}" />
|
||||
|
||||
<!-- set permissions -->
|
||||
<echo>Setting permissions and group ownership in ${directory}'</echo>
|
||||
<repository:exec
|
||||
command="cd ${directory}; chmod -R g+ws *; chmod -R a+r *;chgrp -R maven *" />
|
||||
</define:tag>
|
||||
|
||||
<!--
|
||||
! place the file name portion of a url into a variable
|
||||
! @param url the URL to process
|
||||
! @param var the variable to place the filename into
|
||||
!-->
|
||||
<define:tag name="urlFileName">
|
||||
<u:tokenize var="preQuery" delim="?">${url}</u:tokenize>
|
||||
<u:tokenize var="slashes" delim="/">${preQuery[0]}</u:tokenize>
|
||||
<j:set var="${var}" scope="parent" value="${slashes[size(slashes)-1]}" />
|
||||
</define:tag>
|
||||
</define:taglib>
|
||||
|
||||
<goal name="repository:audit-create-licenses"
|
||||
description="create the license directories, for all groups in the audit file, in the repository">
|
||||
<!--
|
||||
! parse audit file
|
||||
! run ssh to create each <groupId>/licenses directory.
|
||||
!-->
|
||||
<repository:parseAudit var="audit"/>
|
||||
|
||||
<x:forEach var="group" select="$audit/licenses/project/groupId">
|
||||
|
||||
<echo>Processing project ${group.text}</echo>
|
||||
<j:set var="directory" value="${maven.repo.central.directory}/${group.text}/licenses" />
|
||||
<j:set var="command" value="mkdir -p ${directory}; chmod g+ws ${directory}; chgrp maven ${directory}" />
|
||||
<echo>Checking directory '${directory}'</echo>
|
||||
<repository:exec command="${command}"/>
|
||||
|
||||
</x:forEach>
|
||||
</goal>
|
||||
|
||||
<goal name="repository:audit-copy-licenses"
|
||||
description="copy all licenses in the audit file to the repository">
|
||||
<!--
|
||||
! parse audit file
|
||||
! get the file (using http) and copy to <groupId>/licenses directory.
|
||||
!-->
|
||||
<repository:parseAudit var="audit"/>
|
||||
|
||||
<!-- see if the user specified a starting project -->
|
||||
<j:set var="processing" value="true" />
|
||||
<j:if test="${!empty(startProject)}">
|
||||
<j:set var="processing" value="false"/>
|
||||
</j:if>
|
||||
|
||||
<x:forEach var="project" select="$audit/licenses/project">
|
||||
<j:set var="group"><x:expr select="$project/groupId"/></j:set>
|
||||
<echo>Processing project ${group}</echo>
|
||||
<j:if test="${!processing and group.equals(startProject)}">
|
||||
<j:set var="processing" value="true"/>
|
||||
</j:if>
|
||||
<j:set var="directory" value="${maven.repo.central.directory}/${group}/licenses/" />
|
||||
<!-- get file and don't let the & get reescaped -->
|
||||
<x:set var="xfile" select="string($project/file)" />
|
||||
<j:set var="file" value="${xfile}"/>
|
||||
|
||||
<j:if test="${file != '' and processing}">
|
||||
<repository:copyLicense url="${file}" groupId="${group}" />
|
||||
</j:if>
|
||||
</x:forEach>
|
||||
</goal>
|
||||
|
||||
<!-- expects groupId to be set -->
|
||||
<goal name="repository:audit-copy-license"
|
||||
description="copy the license for the specified groupId to the repository">
|
||||
<j:if test="${empty(groupId)}">
|
||||
<fail>groupId must be specified</fail>
|
||||
</j:if>
|
||||
|
||||
<!--
|
||||
! parse audit file
|
||||
! get the file (using http) and copy to <groupId>/licenses directory.
|
||||
!-->
|
||||
<repository:parseAudit var="audit"/>
|
||||
|
||||
<x:forEach var="project" select="$audit/licenses/project">
|
||||
<j:set var="group"><x:expr select="$project/groupId"/></j:set>
|
||||
<j:if test="${group.equals(groupId)}">
|
||||
|
||||
<echo>Copying license for ${group}</echo>
|
||||
<!-- get file and don't let the & get reescaped -->
|
||||
<x:set var="xfile" select="string($project/file)" />
|
||||
<j:set var="file" value="${xfile}"/>
|
||||
|
||||
<j:if test="${file != ''}">
|
||||
<repository:copyLicense url="${file}" groupId="${group}" />
|
||||
</j:if>
|
||||
|
||||
</j:if>
|
||||
</x:forEach>
|
||||
</goal>
|
||||
|
||||
<!-- expects groupId to be set -->
|
||||
<goal name="repository:create-project"
|
||||
description="create a project, specified by groupId, in the repository">
|
||||
<j:if test="${empty(groupId)}">
|
||||
<fail>groupId must be specified</fail>
|
||||
</j:if>
|
||||
<j:set var="command" value="cd ${maven.repo.central.directory}"/>
|
||||
<j:set var="command" value="${command};mkdir ${groupId}" />
|
||||
<j:set var="command" value="${command};chgrp maven ${groupId}"/>
|
||||
<j:set var="command" value="${command};chmod g+s ${groupId}"/>
|
||||
<j:set var="command" value="${command};mkdir ${groupId}/distributions"/>
|
||||
<j:set var="command" value="${command};mkdir ${groupId}/jars"/>
|
||||
<j:set var="command" value="${command};mkdir ${groupId}/licenses"/>
|
||||
<j:set var="command" value="${command};mkdir ${groupId}/poms"/>
|
||||
<j:set var="command" value="${command};chmod -R g+ws ${groupId}"/>
|
||||
<j:set var="command" value="${command};chmod -R a+r ${groupId}"/>
|
||||
<echo>executing '${command}' remotely</echo>
|
||||
<repository:exec command="${command}" />
|
||||
</goal>
|
||||
|
||||
<!-- expects groupId to be set -->
|
||||
<goal name="repository:delete-project"
|
||||
description="delete a project, specified by groupId, in the repository">
|
||||
<j:if test="${empty(groupId)}">
|
||||
<fail>groupId must be specified</fail>
|
||||
</j:if>
|
||||
<j:set var="command" value="cd ${maven.repo.central.directory}"/>
|
||||
<j:set var="command" value="${command};rm -rf ${groupId}" />
|
||||
<echo>executing '${command}' remotely</echo>
|
||||
<repository:exec command="${command}" />
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
3
repository/plugin.properties
Normal file
3
repository/plugin.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P L U G I N P R O P E R I E S
|
||||
# -------------------------------------------------------------------
|
||||
7
repository/project.properties
Normal file
7
repository/project.properties
Normal file
@@ -0,0 +1,7 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P R O J E C T P R O P E R T I E S
|
||||
# -------------------------------------------------------------------
|
||||
maven.xdoc.date=left
|
||||
maven.xdoc.version=${pom.currentVersion}
|
||||
maven.license.licenseFile=${basedir}/../../../LICENSE.txt
|
||||
|
||||
57
repository/project.xml
Normal file
57
repository/project.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project>
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-repository-plugin</id>
|
||||
<name>Maven Repository Plug-in</name>
|
||||
<currentVersion>1.0-SNAPSHOT</currentVersion>
|
||||
<shortDescription>Tools to work with the central repo</shortDescription>
|
||||
|
||||
<url>http://jakarta.apache.org/turbine/maven/reference/plugins/repository/</url>
|
||||
|
||||
<issueTrackingUrl>http://jira.werken.com/BrowseProject.jspa?id=10030</issueTrackingUrl>
|
||||
|
||||
<siteAddress>jakarta.apache.org</siteAddress>
|
||||
<siteDirectory>/www/jakarta.apache.org/turbine/maven/reference/plugins/repository/</siteDirectory>
|
||||
|
||||
<distributionDirectory>/www/jakarta.apache.org/builds/jakarta-turbine-maven/</distributionDirectory>
|
||||
|
||||
<repository>
|
||||
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-turbine-maven/src/plugins-build/repository/</connection>
|
||||
<url>http://cvs.apache.org/viewcvs/jakarta-turbine-maven/src/plugins-build/repository/</url>
|
||||
</repository>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>dIon Gillard</name>
|
||||
<id>dion</id>
|
||||
<email>dion@apache.org</email>
|
||||
<organization>Apache Software Foundation</organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<dependencies>
|
||||
<!-- define is part of maven -->
|
||||
<dependency>
|
||||
<groupId>commons-jelly</groupId>
|
||||
<artifactId>commons-jelly-tags-util</artifactId>
|
||||
<version>20030211.141939</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-jelly</groupId>
|
||||
<artifactId>commons-jelly-tags-xml</artifactId>
|
||||
<version>20030211.142705</version>
|
||||
<url>http://jakarta.apache.org/commons/jelly/tags/xml/</url>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
1594
repository/src/plugin-resources/repository-audit.xml
Normal file
1594
repository/src/plugin-resources/repository-audit.xml
Normal file
File diff suppressed because it is too large
Load Diff
32
repository/xdocs/goals.xml
Normal file
32
repository/xdocs/goals.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>Maven Repository Plug-in Goals</title>
|
||||
<author email="dion@apache.org">dIon Gillard</author>
|
||||
</properties>
|
||||
<body>
|
||||
<goals>
|
||||
<goal>
|
||||
<name>repository:audit-copy-license</name>
|
||||
<description>copy the license for the specified groupId to the repository</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>repository:audit-copy-licenses</name>
|
||||
<description>copy all licenses in the audit file to the repository</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>repository:audit-create-licenses</name>
|
||||
<description>create the license directories, for all groups in the audit file, in the repository</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>repository:create-project</name>
|
||||
<description>create a project, specified by groupId, in the repository</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>repository:delete-project</name>
|
||||
<description>delete a project, specified by groupId, in the repository</description>
|
||||
</goal>
|
||||
</goals>
|
||||
</body>
|
||||
</document>
|
||||
16
repository/xdocs/index.xml
Normal file
16
repository/xdocs/index.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven Repository Plug-in</title>
|
||||
<author email="dion@apache.org">dIon Gillard</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven Repositiry Plug-in">
|
||||
<p>
|
||||
This plug-in provides ways of working with maven central repositories
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
17
repository/xdocs/navigation.xml
Normal file
17
repository/xdocs/navigation.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project name="Maven Repository Plug-in">
|
||||
<title>Maven Repository Plug-in</title>
|
||||
<body>
|
||||
<links>
|
||||
<item href="http://jakarta.apache.org/turbine/maven/" name="Maven">
|
||||
</item>
|
||||
</links>
|
||||
<menu name="Overview">
|
||||
<item href="/goals.html" name="Goals">
|
||||
</item>
|
||||
<item href="/properties.html" name="Properties">
|
||||
</item>
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
19
repository/xdocs/properties.xml
Normal file
19
repository/xdocs/properties.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>Maven Repository Plug-in Properties</title>
|
||||
<author email="dion@apache.org">dIon Gillard</author>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="Maven Repository Plug-in Settings">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
Reference in New Issue
Block a user