You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2006/09/10 23:02:03 UTC
svn commit: r442006 - in /maven/plugins/trunk/maven-antlr-plugin: ./
src/main/java/org/apache/maven/plugin/antlr/ src/site/ src/site/apt/
src/site/apt/examples/ src/site/fml/
Author: vsiveton
Date: Sun Sep 10 14:02:03 2006
New Revision: 442006
URL: http://svn.apache.org/viewvc?view=rev&rev=442006
Log:
MANTLR-8: Review plugin documentation
o updated javadoc
o added documentation
o satisfied docck plugin
- bumped version of org.apache.maven.plugins to 4-SNAPSHOT
- added unused example
Added:
maven/plugins/trunk/maven-antlr-plugin/src/site/
maven/plugins/trunk/maven-antlr-plugin/src/site/apt/
maven/plugins/trunk/maven-antlr-plugin/src/site/apt/examples/
maven/plugins/trunk/maven-antlr-plugin/src/site/apt/examples/unused.apt (with props)
maven/plugins/trunk/maven-antlr-plugin/src/site/apt/index.apt (with props)
maven/plugins/trunk/maven-antlr-plugin/src/site/apt/usage.apt (with props)
maven/plugins/trunk/maven-antlr-plugin/src/site/fml/
maven/plugins/trunk/maven-antlr-plugin/src/site/fml/faq.fml (with props)
maven/plugins/trunk/maven-antlr-plugin/src/site/site.xml (with props)
Modified:
maven/plugins/trunk/maven-antlr-plugin/pom.xml
maven/plugins/trunk/maven-antlr-plugin/src/main/java/org/apache/maven/plugin/antlr/AntlrPlugin.java
Modified: maven/plugins/trunk/maven-antlr-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antlr-plugin/pom.xml?view=diff&rev=442006&r1=442005&r2=442006
==============================================================================
--- maven/plugins/trunk/maven-antlr-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-antlr-plugin/pom.xml Sun Sep 10 14:02:03 2006
@@ -1,69 +1,40 @@
-<project>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ Copyright 2006 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>maven-plugins</artifactId>
<groupId>org.apache.maven.plugins</groupId>
- <version>1</version>
+ <version>4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-antlr-plugin</artifactId>
- <packaging>maven-plugin</packaging>
- <name>Maven ANTLR Plugin</name>
+ <packaging>maven-plugin</packaging>
<version>2.0-beta-2-SNAPSHOT</version>
- <inceptionYear>2001</inceptionYear>
+ <name>Maven ANTLR Plugin</name>
+ <prerequisites>
+ <maven>2.0</maven>
+ </prerequisites>
<issueManagement>
<system>jira</system>
<url>http://jira.codehaus.org/browse/MANTLR</url>
</issueManagement>
- <mailingLists>
- <!-- duplication from maven-plugins pom - temporary until they inherit properly -->
- <mailingList>
- <name>Maven User List</name>
- <subscribe>users-subscribe@maven.apache.org</subscribe>
- <unsubscribe>users-unsubscribe@maven.apache.org</unsubscribe>
- <post>users@maven.apache.org</post>
- <archive>http://mail-archives.apache.org/mod_mbox/maven-users</archive>
- <otherArchives>
- <otherArchive>http://www.mail-archive.com/users@maven.apache.org/</otherArchive>
- <otherArchive>http://www.nabble.com/Maven---Users-f178.html</otherArchive>
- </otherArchives>
- </mailingList>
- <mailingList>
- <name>Maven Developer List</name>
- <subscribe>dev-subscribe@maven.apache.org</subscribe>
- <unsubscribe>dev-unsubscribe@maven.apache.org</unsubscribe>
- <post>dev@maven.apache.org</post>
- <archive>http://mail-archives.apache.org/mod_mbox/maven-dev</archive>
- </mailingList>
- <mailingList>
- <name>Maven Commits List</name>
- <subscribe>commits-subscribe@maven.apache.org</subscribe>
- <unsubscribe>commits-unsubscribe@maven.apache.org</unsubscribe>
- <post>commits@maven.apache.org</post>
- <archive>http://mail-archives.apache.org/mod_mbox/maven-dev</archive>
- </mailingList>
- <!-- duplication from maven-parent pom - temporary until they inherit properly -->
- <mailingList>
- <name>Maven Announcements List</name>
- <post>announce@maven.apache.org</post>
- <subscribe>announce-subscribe@maven.apache.org</subscribe>
- <unsubscribe>announce-unsubscribe@maven.apache.org</unsubscribe>
- <archive>http://mail-archives.apache.org/mod_mbox/maven-announce/</archive>
- </mailingList>
- <mailingList>
- <name>Maven Issues List</name>
- <post>issues@maven.apache.org</post>
- <subscribe>issues-subscribe@maven.apache.org</subscribe>
- <unsubscribe>issues-unsubscribe@maven.apache.org</unsubscribe>
- <archive>http://mail-archives.apache.org/mod_mbox/maven-issues/</archive>
- </mailingList>
- <mailingList>
- <name>Maven Notifications List</name>
- <post>notifications@maven.apache.org</post>
- <subscribe>notifications-subscribe@maven.apache.org</subscribe>
- <unsubscribe>notifications-unsubscribe@maven.apache.org</unsubscribe>
- <archive>http://mail-archives.apache.org/mod_mbox/maven-notifications/</archive>
- </mailingList>
- </mailingLists>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
Modified: maven/plugins/trunk/maven-antlr-plugin/src/main/java/org/apache/maven/plugin/antlr/AntlrPlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antlr-plugin/src/main/java/org/apache/maven/plugin/antlr/AntlrPlugin.java?view=diff&rev=442006&r1=442005&r2=442006
==============================================================================
--- maven/plugins/trunk/maven-antlr-plugin/src/main/java/org/apache/maven/plugin/antlr/AntlrPlugin.java (original)
+++ maven/plugins/trunk/maven-antlr-plugin/src/main/java/org/apache/maven/plugin/antlr/AntlrPlugin.java Sun Sep 10 14:02:03 2006
@@ -1,7 +1,7 @@
package org.apache.maven.plugin.antlr;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2001-2006 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.
@@ -27,46 +27,57 @@
import java.security.Permission;
import java.util.StringTokenizer;
+//----------------------------------------------------------------------
+// Don't remove this snippet
+//----------------------------------------------------------------------
// START SNIPPET: generate-sources-0
/**
+ * Generates files based on grammar files with Antlr tool.
+ *
* @goal generate
* @phase generate-sources
- * @description Antlr plugin
*/
public class AntlrPlugin
extends AbstractMojo
{
/**
+ * Comma separated grammar file names present in the <code>sourceDirectory</code> directory.
+ *
* @parameter expression="${grammars}"
* @required
*/
private String grammars;
/**
+ * Specifies the Antlr directory containing grammar files.
+ *
* @parameter expression="${basedir}/src/main/antlr"
* @required
*/
private File sourceDirectory;
/**
+ * Specifies the destination directory where Antlr should generate files.
+ *
* @parameter expression="${project.build.directory}/generated-sources/antlr"
* @required
*/
private String outputDirectory;
/**
+ * The Maven Project Object
+ *
* @parameter expression="${project}"
* @required
*/
private MavenProject project;
+ /**
+ * @see org.apache.maven.plugin.Mojo#execute()
+ */
public void execute()
throws MojoExecutionException
{
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
StringTokenizer st = new StringTokenizer( grammars, ", " );
while ( st.hasMoreTokens() )
@@ -103,6 +114,10 @@
generated.getParentFile().mkdirs();
}
+ // ----------------------------------------------------------------------
+ // @see http://www.antlr.org/doc/options.html#Command%20Line%20Options
+ // ----------------------------------------------------------------------
+
String[] args = new String[]{"-o", generated.getParentFile().getPath(), grammar.getPath(),};
SecurityManager oldSm = System.getSecurityManager();
@@ -125,15 +140,24 @@
System.setSecurityManager( oldSm );
}
}
-
+
if ( project != null )
{
project.addCompileSourceRoot( outputDirectory );
}
}
-
+
// END SNIPPET: generate-sources-0
-
+ // ----------------------------------------------------------------------
+ // Don't remove this snippet
+ // ----------------------------------------------------------------------
+
+ /**
+ * @param grammar
+ * @param outputDirectory
+ * @return generated file
+ * @throws Exception
+ */
protected File getGeneratedFile( String grammar, String outputDirectory )
throws Exception
{
@@ -143,7 +167,6 @@
try
{
-
BufferedReader in = new BufferedReader( new FileReader( grammar ) );
String line;
@@ -194,7 +217,6 @@
return genFile;
}
-
}
class NoExitSecurityManager
@@ -206,10 +228,16 @@
{
}
+ /**
+ * @see java.lang.SecurityManager#checkPermission(java.security.Permission)
+ */
public void checkPermission( Permission permission )
{
}
+ /**
+ * @see java.lang.SecurityManager#checkExit(int)
+ */
public void checkExit( int status )
{
throw new SecurityException( "exitVM-" + status );
Added: maven/plugins/trunk/maven-antlr-plugin/src/site/apt/examples/unused.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antlr-plugin/src/site/apt/examples/unused.apt?view=auto&rev=442006
==============================================================================
--- maven/plugins/trunk/maven-antlr-plugin/src/site/apt/examples/unused.apt (added)
+++ maven/plugins/trunk/maven-antlr-plugin/src/site/apt/examples/unused.apt Sun Sep 10 14:02:03 2006
@@ -0,0 +1,24 @@
+ ------
+ Unused file only to pass docck:check goal
+ ------
+ Vincent Siveton
+ ------
+ September 2006
+ ------
+
+ ~~ Copyright 2006 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/guides/mini/guide-apt-format.html
Propchange: maven/plugins/trunk/maven-antlr-plugin/src/site/apt/examples/unused.apt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-antlr-plugin/src/site/apt/examples/unused.apt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/plugins/trunk/maven-antlr-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antlr-plugin/src/site/apt/index.apt?view=auto&rev=442006
==============================================================================
--- maven/plugins/trunk/maven-antlr-plugin/src/site/apt/index.apt (added)
+++ maven/plugins/trunk/maven-antlr-plugin/src/site/apt/index.apt Sun Sep 10 14:02:03 2006
@@ -0,0 +1,46 @@
+ ------
+ Introduction
+ ------
+ Vincent Siveton
+ ------
+ September 2006
+ ------
+
+ ~~ Copyright 2006 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/guides/mini/guide-apt-format.html
+
+
+Maven 2 Antlr Plugin
+
+ The Antlr Plugin uses the parser generator {{{http://www.antlr.org/}Antlr}}. For more information
+ about Antlr, please refer to {{{http://www.antlr.org/doc/index.html}Antlr Reference Manual}}.
+
+ Refer to {{{dependencies.html}Project Dependencies}} to know the Antlr version used by the Plugin.
+
+* Goals Overview
+
+ The Antlr Plugin has one goal:
+
+ * {{{generate-mojo.html}antlr:generate}} generates file(s) to a target directory based on grammar file(s).
+
+* Usage
+
+ Instructions on how to use the Antlr Plugin can be found {{{usage.html}here}}.
+
+* Examples
+
+ No example exists.
Propchange: maven/plugins/trunk/maven-antlr-plugin/src/site/apt/index.apt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-antlr-plugin/src/site/apt/index.apt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/plugins/trunk/maven-antlr-plugin/src/site/apt/usage.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antlr-plugin/src/site/apt/usage.apt?view=auto&rev=442006
==============================================================================
--- maven/plugins/trunk/maven-antlr-plugin/src/site/apt/usage.apt (added)
+++ maven/plugins/trunk/maven-antlr-plugin/src/site/apt/usage.apt Sun Sep 10 14:02:03 2006
@@ -0,0 +1,102 @@
+ ------
+ Usage
+ ------
+ Vincent Siveton
+ ------
+ September 2006
+ ------
+
+ ~~ Copyright 2006 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/guides/mini/guide-apt-format.html
+
+
+Usage
+
+ The Antlr Plugin generates files based on grammar file(s). The following examples describe the basic
+ usage of the Plugin.
+
+* Generate Sources From Grammar File(s)
+
+ You must configure the Antlr Plugin as follow:
+
++-----+
+<project>
+...
+ <build>
+ <plugins>
+ ...
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antlr-plugin</artifactId>
+ <configuration>
+ <!--
+ Comma separated list of grammar files.
+ By default, grammar file(s) is in ${basedir}/src/main/antlr
+ -->
+ <grammars>java.g</grammars>
+ </configuration>
+ </plugin>
+ ...
+ </plugins>
+ </build>
+...
+</project>
++-----+
+
+ To generate files, you should execute the generate goal of the Antlr Plugin, i.e.:
+
++-----+
+mvn antlr:generate
++-----+
+
+* Generate Sources From Grammar File(s) As Part Of Your Build
+
+ When you compile your project, the Antlr Plugin could be executed. You should add the generate <<<execution>>>
+ as follow:
+
++-----+
+<project>
+...
+ <build>
+ <plugins>
+ ...
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antlr-plugin</artifactId>
+ <configuration>
+ <!--
+ Comma separated list of grammar files.
+ By default, grammar file is in ${basedir}/src/main/antlr
+ -->
+ <grammars>java.g</grammars>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ ...
+ </plugins>
+ </build>
+...
+</project>
++-----+
+
+ When you execute <<<mvn compile>>>, the files will be generated and included in your compile sources.
Propchange: maven/plugins/trunk/maven-antlr-plugin/src/site/apt/usage.apt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-antlr-plugin/src/site/apt/usage.apt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/plugins/trunk/maven-antlr-plugin/src/site/fml/faq.fml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antlr-plugin/src/site/fml/faq.fml?view=auto&rev=442006
==============================================================================
--- maven/plugins/trunk/maven-antlr-plugin/src/site/fml/faq.fml (added)
+++ maven/plugins/trunk/maven-antlr-plugin/src/site/fml/faq.fml Sun Sep 10 14:02:03 2006
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+
+<!--
+ ~ Copyright 2006 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.
+ -->
+
+<faqs id="FAQ" title="Frequently Asked Questions">
+ <part id="General">
+ <faq id="Where do I put grammar files">
+ <question>Where do I put grammar files?</question>
+ <answer>
+ <p>
+ By default, grammar files should be in the <i>${basedir}/src/main/antlr</i> directory.
+ </p>
+ </answer>
+ </faq>
+ </part>
+</faqs>
\ No newline at end of file
Propchange: maven/plugins/trunk/maven-antlr-plugin/src/site/fml/faq.fml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-antlr-plugin/src/site/fml/faq.fml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/plugins/trunk/maven-antlr-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antlr-plugin/src/site/site.xml?view=auto&rev=442006
==============================================================================
--- maven/plugins/trunk/maven-antlr-plugin/src/site/site.xml (added)
+++ maven/plugins/trunk/maven-antlr-plugin/src/site/site.xml Sun Sep 10 14:02:03 2006
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+ ~ Copyright 2006 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.
+ -->
+
+<project name="Maven 2 Antlr Plugin">
+ <bannerLeft>
+ <name>Maven 2 Antlr Plugin</name>
+ <src>http://maven.apache.org/images/apache-maven-project.png</src>
+ <href>http://maven.apache.org/</href>
+ </bannerLeft>
+ <bannerRight>
+ <src>http://maven.apache.org/images/maven-small.gif</src>
+ </bannerRight>
+ <body>
+ <links>
+ <item name="Maven 2" href="http://maven.apache.org/maven2/"/>
+ <item name="Antlr" href="http://www.antlr.org/"/>
+ </links>
+
+ <menu name="Overview">
+ <item name="Introduction" href="index.html"/>
+ <item name="Goals" href="plugin-info.html"/>
+ <item name="Usage" href="usage.html"/>
+ <item name="FAQ" href="faq.html"/>
+ </menu>
+
+ ${reports}
+ </body>
+</project>
Propchange: maven/plugins/trunk/maven-antlr-plugin/src/site/site.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-antlr-plugin/src/site/site.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"