Permalink
Browse files

Updated versions, renamed skip to skipdocs, removed the skipdocs para…

…meter from the install goal.
  • Loading branch information...
1 parent 208c0f9 commit 7364e516ff1fdaaf2805fb7bebfe0ff9086fc81d @nawroth nawroth committed Jan 12, 2012
View
@@ -175,7 +175,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.10</version>
+ <version>2.11</version>
</plugin>
<!-- non org.apache.maven.plugins -->
<plugin>
@@ -413,7 +413,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
- <version>2.0.6</version>
+ <version>3.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
@@ -438,12 +438,12 @@
<dependency>
<groupId>org.sonatype.aether</groupId>
<artifactId>aether-api</artifactId>
- <version>1.11</version>
+ <version>1.13.1</version>
</dependency>
<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-plexus</artifactId>
- <version>2.1.1</version>
+ <version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
@@ -503,6 +503,28 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>sonatype-oss-release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.1.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.8</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.4</version>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2002-2011 "Neo Technology,"
+ * Network Engine for Objects in Lund AB [http://neotechnology.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.neo4j.build.plugins.docs;
+
+import java.util.List;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+import org.apache.maven.shared.filtering.MavenResourcesFiltering;
+
+/**
+ * Base class for defining common properties.
+ */
+public abstract class AbstractDocsMojo extends AbstractMojo
+{
+ /**
+ * Directories to include in the assembly. This setting replaces the default
+ * one, which is to include src/docs/ and target/docs/.
+ *
+ * @parameter
+ */
+ protected List<String> sourceDirectories;
+ /**
+ * Set to "true" to activate filtering.
+ *
+ * @parameter expression="${filter}" default-value="false"
+ */
+ protected boolean filter;
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @readonly
+ */
+ protected MavenProject project;
+ /**
+ * @component
+ */
+ protected MavenProjectHelper projectHelper;
+ /**
+ *
+ * @component role="org.apache.maven.shared.filtering.MavenResourcesFiltering" role-hint="default"
+ * @required
+ */
+ protected MavenResourcesFiltering resourceFiltering;
+ /**
+ * @parameter default-value="${session}"
+ * @readonly
+ * @required
+ */
+ protected MavenSession session;
+}
@@ -19,14 +19,8 @@
*/
package org.neo4j.build.plugins.docs;
-import java.util.List;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectHelper;
-import org.apache.maven.shared.filtering.MavenResourcesFiltering;
/**
* Goal which assembles docs.
@@ -35,61 +29,19 @@
* @phase package
* @threadsafe
*/
-public class AssembleMojo extends AbstractMojo
+public class AssembleMojo extends AbstractDocsMojo
{
/**
- * Directories to include in the assembly. This setting replaces the default
- * one, which is to include src/docs/ and target/docs/.
- *
- * @parameter
- */
- protected List<String> sourceDirectories;
-
- /**
- * Set to "true" to activate filtering.
- *
- * @parameter expression="${filter}" default-value="false"
- */
- protected boolean filter;
-
- /**
* Set to "true" to skip execution.
*
- * @parameter expression="${skip}" default-value="false"
- */
- protected boolean skip;
-
- /**
- * The maven project.
- *
- * @parameter expression="${project}"
- * @readonly
- */
- protected MavenProject project;
-
- /**
- * @component
- */
- protected MavenProjectHelper projectHelper;
-
- /**
- *
- * @component role="org.apache.maven.shared.filtering.MavenResourcesFiltering" role-hint="default"
- * @required
- */
- protected MavenResourcesFiltering resourceFiltering;
-
- /**
- * @parameter default-value="${session}"
- * @readonly
- * @required
+ * @parameter expression="${skipdocs}" default-value="false"
*/
- protected MavenSession session;
+ protected boolean skipdocs;
@Override
public void execute() throws MojoExecutionException
{
- if ( skip )
+ if ( skipdocs )
{
skip();
}
@@ -26,6 +26,7 @@
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.zip.ZipEntry;
@@ -45,15 +46,15 @@
final class DocsAssembler
{
- private static final String DOCS_DIRNAME = "docs";
-
- private static final String CLASSIFIER = "docs";
+ static final String CLASSIFIER = "docs";
- private static final String TYPE = "jar";
+ static final String TYPE = "jar";
private static final int BUFFER_SIZE = 4096;
- private int currentBaseDirPathLength;
+ private static final String DOCS_DIRNAME = "docs";
+
+ private static final List<String> NON_FILTERED_FILE_EXTENSIONS;
private final Log log;
@@ -65,8 +66,21 @@
private MavenSession session;
+ private int currentBaseDirPathLength;
+
private ZipOutputStream zipOut;
+ static
+ {
+ // these are always non-filtered anyhow:
+ // jpg, jpeg, gif, bmp, png
+ // as defined in
+ // org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering
+
+ NON_FILTERED_FILE_EXTENSIONS = Arrays.asList( new String[] { "tiff",
+ "tif", "pdf", "zip", "gz" } );
+ }
+
private Log getLog()
{
return log;
@@ -207,7 +221,7 @@ private void filterResources( final List<File> directories, File targetDir )
MavenResourcesExecution resourcesExecution = new MavenResourcesExecution(
resources, targetDir, project, "UTF-8",
- Collections.emptyList(), Collections.emptyList(), session );
+ Collections.emptyList(), NON_FILTERED_FILE_EXTENSIONS, session );
resourcesExecution.setResourcesBaseDirectory( project.getBasedir() );
resourcesExecution.addFilterWrapper( new FileUtils.FilterWrapper()
{
@@ -341,7 +355,7 @@ private static void deleteRecursively( File file )
if ( !file.delete() )
{
throw new RuntimeException(
- "Couldn't empty database. Offending file:" + file );
+ "Couldn't delete directory. Offending file:" + file );
}
}
}
@@ -43,8 +43,12 @@
* @requiresDirectInvocation
* @requiresDependencyResolution test
*/
-public class InstallMojo extends AssembleMojo
+public class InstallMojo extends AbstractDocsMojo
{
+ private static final String INSTALL_PLUGIN_VERSION = "2.3.1";
+
+ private static final String SUREFIRE_PLUGIN_VERSION = "2.11";
+
/**
* Test to execute.
*
@@ -63,11 +67,6 @@
@Override
public void execute() throws MojoExecutionException
{
- if ( skip )
- {
- skip();
- return;
- }
if ( test != null )
{
getLog().info( "Preparing to execute test: " + test );
@@ -80,38 +79,38 @@ private void executeTest() throws MojoExecutionException
{
executeMojo(
plugin( groupId( "org.apache.maven.plugins" ),
- artifactId( "maven-surefire-plugin" ), version( "2.10" ) ),
- goal( "test" ),
- configuration( element( name( "test" ), test ) ),
- executionEnvironment( project, session, pluginManager ) );
+ artifactId( "maven-surefire-plugin" ), version( SUREFIRE_PLUGIN_VERSION ) ),
+ goal( "test" ),
+ configuration( element( name( "test" ), test ) ),
+ executionEnvironment( project, session, pluginManager ) );
}
private void assembleInstall() throws MojoExecutionException
{
- final File destFile = DocsAssembler.assemble( sourceDirectories, filter,
- getLog(), session, project, projectHelper,
+ final File destFile = DocsAssembler.assemble( sourceDirectories,
+ filter, getLog(), session, project, projectHelper,
resourceFiltering );
final String file = destFile.getAbsolutePath();
final String pomFile = new File( project.getBasedir(), "pom.xml" ).getAbsolutePath();
final String groupId = project.getGroupId();
final String artifactId = project.getArtifactId();
final String version = project.getVersion();
- final String classifier = "docs";
- final String packaging = "jar";
+ final String classifier = DocsAssembler.CLASSIFIER;
+ final String packaging = DocsAssembler.TYPE;
final String generatePom = "false";
executeMojo(
plugin( groupId( "org.apache.maven.plugins" ),
- artifactId( "maven-install-plugin" ), version( "2.3.1" ) ),
- goal( "install-file" ),
- configuration( element( name( "file" ), file ),
- element( name( "pomFile" ), pomFile ),
- element( name( "groupId" ), groupId ),
- element( name( "artifactId" ), artifactId ),
- element( name( "version" ), version ),
- element( name( "classifier" ), classifier ),
- element( name( "packaging" ), packaging ),
- element( name( "generatePom" ), generatePom ) ),
- executionEnvironment( project, session, pluginManager ) );
+ artifactId( "maven-install-plugin" ), version( INSTALL_PLUGIN_VERSION ) ),
+ goal( "install-file" ),
+ configuration( element( name( "file" ), file ),
+ element( name( "pomFile" ), pomFile ),
+ element( name( "groupId" ), groupId ),
+ element( name( "artifactId" ), artifactId ),
+ element( name( "version" ), version ),
+ element( name( "classifier" ), classifier ),
+ element( name( "packaging" ), packaging ),
+ element( name( "generatePom" ), generatePom ) ),
+ executionEnvironment( project, session, pluginManager ) );
}
}

0 comments on commit 7364e51

Please sign in to comment.