Author: jvanzyl Date: Mon Jul 17 13:28:56 2006 New Revision: 422841 URL: http://svn.apache.org/viewvc?rev=422841&view=rev Log: doap plugin
Added: maven/sandbox/plugins/maven-doap-plugin/ maven/sandbox/plugins/maven-doap-plugin/doap_Maven.rdf (with props) maven/sandbox/plugins/maven-doap-plugin/pom.xml (with props) maven/sandbox/plugins/maven-doap-plugin/src/ maven/sandbox/plugins/maven-doap-plugin/src/main/ maven/sandbox/plugins/maven-doap-plugin/src/main/java/ maven/sandbox/plugins/maven-doap-plugin/src/main/java/org/ maven/sandbox/plugins/maven-doap-plugin/src/main/java/org/apache/ maven/sandbox/plugins/maven-doap-plugin/src/main/java/org/apache/maven/ maven/sandbox/plugins/maven-doap-plugin/src/main/java/org/apache/maven/plugins/ maven/sandbox/plugins/maven-doap-plugin/src/main/java/org/apache/maven/plugins/doap/ maven/sandbox/plugins/maven-doap-plugin/src/main/java/org/apache/maven/plugins/doap/DoapMojo.java (with props) maven/sandbox/plugins/maven-doap-plugin/src/test/ maven/sandbox/plugins/maven-doap-plugin/src/test/java/ maven/sandbox/plugins/maven-doap-plugin/src/test/java/org/ maven/sandbox/plugins/maven-doap-plugin/src/test/java/org/apache/ maven/sandbox/plugins/maven-doap-plugin/src/test/java/org/apache/maven/ maven/sandbox/plugins/maven-doap-plugin/src/test/java/org/apache/maven/plugins/ maven/sandbox/plugins/maven-doap-plugin/src/test/java/org/apache/maven/plugins/doap/ maven/sandbox/plugins/maven-doap-plugin/src/test/java/org/apache/maven/plugins/doap/AppTest.java (with props) Added: maven/sandbox/plugins/maven-doap-plugin/doap_Maven.rdf URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-doap-plugin/doap_Maven.rdf?rev=422841&view=auto ============================================================================== --- maven/sandbox/plugins/maven-doap-plugin/doap_Maven.rdf (added) +++ maven/sandbox/plugins/maven-doap-plugin/doap_Maven.rdf Mon Jul 17 13:28:56 2006 @@ -0,0 +1,64 @@ +<?xml version="1.0"?> +<?xml-stylesheet type="text/xsl"?> +<rdf:RDF xml:lang="en" + xmlns="http://usefulinc.com/ns/doap#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:asfext="http://projects.apache.org/ns/asfext#" + xmlns:foaf="http://xmlns.com/foaf/0.1/"> +<!-- + ======================================================================= + + Copyright (c) 2006 The Apache Software Foundation. + All rights reserved. + + ======================================================================= +--> + <Project rdf:about="http://Maven.rdf.apache.org/"> + <created>2006-02-28</created> + <license rdf:resource="http://usefulinc.com/doap/licenses/asl20" /> + <name>Apache Maven</name> + <homepage rdf:resource="http://maven.apache.org" /> + <asfext:pmc rdf:resource="http://maven.apache.org" /> + <shortdesc>Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.</shortdesc> + <description>At first glance Maven can appear to be many things, but in a nutshell Maven is an attempt to apply patterns to a project's build infrastructure in order to promote comprehension and productivity by providing a clear path in the use of best practices. Maven is essentially a project management and comprehension tool and as such provides a way to help with managing: + + * Builds + * Documentation + * Reporting + * Dependencies + * SCMs + * Releases + * Distribution</description> + <bug-database rdf:resource="http://jira.codehaus.org/browse/MNG" /> + <mailing-list rdf:resource="http://maven.apache.org/mail-lists.html" /> + <download-page rdf:resource="http://maven.apache.org/download.html" /> + <programming-language>Java</programming-language> + <category rdf:resource="http://projects.apache.org/category/build-management" /> + <release> + <Version> + <name>Latest stable release</name> + <created>2006-03-28</created> + <revision>2.0.3</revision> + </Version> + </release> + <release> + <Version> + <name>Maven 2.0.2</name> + <created>2006-01-16</created> + <revision>2.0.2</revision> + </Version> + </release> + <repository> + <SVNRepository> + <location rdf:resource="http://svn.apache.org/repos/asf/maven/components/trunk/"/> + <browse rdf:resource="http://svn.apache.org/viewcvs.cgi/maven/components/trunk/"/> + </SVNRepository> + </repository> + <maintainer> + <foaf:Person> + <foaf:name>Emmanuel Venisse</foaf:name> + <foaf:mbox rdf:resource="mailto:[EMAIL PROTECTED]"/> + </foaf:Person> + </maintainer> + </Project> +</rdf:RDF> Propchange: maven/sandbox/plugins/maven-doap-plugin/doap_Maven.rdf ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/plugins/maven-doap-plugin/doap_Maven.rdf ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/sandbox/plugins/maven-doap-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-doap-plugin/pom.xml?rev=422841&view=auto ============================================================================== --- maven/sandbox/plugins/maven-doap-plugin/pom.xml (added) +++ maven/sandbox/plugins/maven-doap-plugin/pom.xml Mon Jul 17 13:28:56 2006 @@ -0,0 +1,24 @@ +<project> + <parent> + <artifactId>maven-plugin-parent</artifactId> + <groupId>org.apache.maven.plugins</groupId> + <version>2.0</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>maven-doap-plugin</artifactId> + <packaging>maven-plugin</packaging> + <name>Maven DOAP Plugin</name> + <version>1.0-SNAPSHOT</version> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-utils</artifactId> + <version>1.1</version> + </dependency> + </dependencies> +</project> Propchange: maven/sandbox/plugins/maven-doap-plugin/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/plugins/maven-doap-plugin/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/sandbox/plugins/maven-doap-plugin/src/main/java/org/apache/maven/plugins/doap/DoapMojo.java URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-doap-plugin/src/main/java/org/apache/maven/plugins/doap/DoapMojo.java?rev=422841&view=auto ============================================================================== --- maven/sandbox/plugins/maven-doap-plugin/src/main/java/org/apache/maven/plugins/doap/DoapMojo.java (added) +++ maven/sandbox/plugins/maven-doap-plugin/src/main/java/org/apache/maven/plugins/doap/DoapMojo.java Mon Jul 17 13:28:56 2006 @@ -0,0 +1,112 @@ +package org.apache.maven.plugin.ant; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter; +import org.codehaus.plexus.util.xml.XMLWriter; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.Writer; + +/** + * A Maven2 plugin to generate an Ant build file. + * + * @author Jason van Zyl + * @version $Id:$ + * @goal generate + */ +public class DoapMojo + extends AbstractMojo +{ + /** + * The project to create a build for. + * + * @parameter expression="${project}" + * @required + */ + private MavenProject project; + + /** + * @parameter expression="${basedir}/doap_${project.artifactId}.rdf" + */ + private File doapFile; + + private XMLWriter w; + + public void execute() + throws MojoExecutionException + { + // ---------------------------------------------------------------------------- + // setup pretty print xml writer + // ---------------------------------------------------------------------------- + + Writer writer; + + try + { + writer = new FileWriter( doapFile ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error creating DOAP file.", e ); + } + + PrintWriter pw = new PrintWriter( writer ); + + w = new PrettyPrintXMLWriter( pw ); + + // ---------------------------------------------------------------------------- + // Convert POM to DOAP + // ---------------------------------------------------------------------------- + + w.startElement( "rdf:RDF"); + w.addAttribute( "xml:lang", "en" ); + w.addAttribute( "xmlns", "http://usefulinc.com/ns/doap#" ); + w.addAttribute( "xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ); + w.addAttribute( "xmlns:asfext", "http://projects.apache.org/ns/asfext#" ); + w.addAttribute( "xmlns:foaf", "http://xmlns.com/foaf/0.1/" ); + + w.startElement( "Project"); + w.addAttribute( "rdf:about", "http://Maven.rdf.apache.org/" ); + element( "created", project.getInceptionYear() ); + //element( "license", (String) project.getLicenses().get(0) ); + element( "name", project.getName() ); + //element( "homepage") + + + w.endElement(); + w.endElement(); + + pw.close(); + } + + private void element( String name, String value ) + { + if ( value != null ) + { + w.startElement( name ); + w.writeText( value ); + w.endElement(); + } + } +} Propchange: maven/sandbox/plugins/maven-doap-plugin/src/main/java/org/apache/maven/plugins/doap/DoapMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/plugins/maven-doap-plugin/src/main/java/org/apache/maven/plugins/doap/DoapMojo.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/sandbox/plugins/maven-doap-plugin/src/test/java/org/apache/maven/plugins/doap/AppTest.java URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-doap-plugin/src/test/java/org/apache/maven/plugins/doap/AppTest.java?rev=422841&view=auto ============================================================================== --- maven/sandbox/plugins/maven-doap-plugin/src/test/java/org/apache/maven/plugins/doap/AppTest.java (added) +++ maven/sandbox/plugins/maven-doap-plugin/src/test/java/org/apache/maven/plugins/doap/AppTest.java Mon Jul 17 13:28:56 2006 @@ -0,0 +1,38 @@ +package org.apache.maven.plugins.doap; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} Propchange: maven/sandbox/plugins/maven-doap-plugin/src/test/java/org/apache/maven/plugins/doap/AppTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/plugins/maven-doap-plugin/src/test/java/org/apache/maven/plugins/doap/AppTest.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision"