Author: ssmiweve Date: 2007-11-05 15:39:46 +0100 (Mon, 05 Nov 2007) New Revision: 5867
Added: trunk/mojo/ trunk/mojo/pom.xml trunk/mojo/src/ trunk/mojo/src/main/ trunk/mojo/src/main/java/ trunk/mojo/src/main/java/no/ trunk/mojo/src/main/java/no/sesat/ trunk/mojo/src/main/java/no/sesat/mojo/ trunk/mojo/src/main/java/no/sesat/mojo/ArtifactItem.java trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java trunk/mojo/src/test/ trunk/mojo/src/test/java/ trunk/mojo/src/test/java/no/ trunk/mojo/src/test/java/no/sesat/ trunk/mojo/src/test/java/no/sesat/mojo/ Modified: trunk/war/pom.xml Log: SEARCH-3539 - A Better Sesat and Skins build system Added: trunk/mojo/pom.xml =================================================================== --- trunk/mojo/pom.xml (rev 0) +++ trunk/mojo/pom.xml 2007-11-05 14:39:46 UTC (rev 5867) @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (2007) Schibsted Søk AS + * This file is part of SESAT. + * + * SESAT 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. + * + * SESAT 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 SESAT. If not, see <http://www.gnu.org/licenses/>. +--> +<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> + <groupId>sesat</groupId> + <artifactId>search-portal</artifactId> + <version>2.16-SNAPSHOT</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + <name>Sesat Mojo</name> + <artifactId>sesat-mojo</artifactId> + <packaging>maven-plugin</packaging> + + <description>SESAT's Mojos.</description> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>2.0.7</version> + </dependency> + <dependency> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.0-alpha-4</version> + <scope>compile</scope> + </dependency> + </dependencies> +</project> Property changes on: trunk/mojo/pom.xml ___________________________________________________________________ Name: svn:executable + * Added: trunk/mojo/src/main/java/no/sesat/mojo/ArtifactItem.java =================================================================== --- trunk/mojo/src/main/java/no/sesat/mojo/ArtifactItem.java (rev 0) +++ trunk/mojo/src/main/java/no/sesat/mojo/ArtifactItem.java 2007-11-05 14:39:46 UTC (rev 5867) @@ -0,0 +1,54 @@ +/* + * Copyright (2007) Schibsted Søk AS + * This file is part of SESAT. + * + * SESAT 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. + * + * SESAT 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 SESAT. If not, see <http://www.gnu.org/licenses/>. + */ + +package no.sesat.mojo; + +/** + * + * @author mick + * @version $Id$ + */ +public class ArtifactItem extends org.apache.maven.plugin.dependency.fromConfiguration.ArtifactItem{ + + // Constants ----------------------------------------------------- + + //private static final Logger LOG = Logger.getLogger(ArtifactItem.class); + + // Attributes ---------------------------------------------------- + + // Static -------------------------------------------------------- + + // Constructors -------------------------------------------------- + + public ArtifactItem() { + } + + // Public -------------------------------------------------------- + + // Z implementation ---------------------------------------------- + + // Y overrides --------------------------------------------------- + + // Package protected --------------------------------------------- + + // Protected ----------------------------------------------------- + + // Private ------------------------------------------------------- + + // Inner classes ------------------------------------------------- +} Property changes on: trunk/mojo/src/main/java/no/sesat/mojo/ArtifactItem.java ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java =================================================================== --- trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java (rev 0) +++ trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java 2007-11-05 14:39:46 UTC (rev 5867) @@ -0,0 +1,260 @@ +/* + * Copyright (2007) Schibsted Søk AS + * This file is part of SESAT. + * + * SESAT 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. + * + * SESAT 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 SESAT. If not, see <http://www.gnu.org/licenses/>. + */ + +package no.sesat.mojo; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import org.apache.maven.artifact.metadata.ArtifactMetadataSource; +import org.apache.maven.artifact.resolver.ArtifactCollector; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.archiver.manager.ArchiverManager; + +/** + * + * @goal local-deploy + * @author mick + * @version $Id$ + */ +public class DeploySesatWarfilesMojo extends CopyMojo{ + + // Constants ----------------------------------------------------- + + // Attributes ---------------------------------------------------- + + // All of these attributes are just explicit overrides to get them into the mojo. + // read http://www.mail-archive.com/[EMAIL PROTECTED]/msg60770.html + + /** + * Strip artifact version during copy + * + * @parameter expression="${mdep.stripVersion}" default-value="false" + * @parameter + */ + private boolean stripVersion = false; + + /** + * Default location used for mojo unless overridden in ArtifactItem + * + * @parameter expression="${outputDirectory}" + * default-value="${project.build.directory}/dependency" + * @optional + * @since 1.0 + */ + private File outputDirectory; + + /** + * Overwrite release artifacts + * + * @optional + * @since 1.0 + * @parameter expression="${mdep.overWriteReleases}" default-value="false" + */ + private boolean overWriteReleases; + + /** + * Overwrite snapshot artifacts + * + * @optional + * @since 1.0 + * @parameter expression="${mdep.overWriteSnapshots}" default-value="false" + */ + private boolean overWriteSnapshots; + + /** + * Overwrite if newer + * + * @optional + * @since 2.0 + * @parameter expression="${mdep.overIfNewer}" default-value="true" + */ + private boolean overWriteIfNewer; + + /** + * Collection of ArtifactItems to work on. (ArtifactItem contains groupId, + * artifactId, version, type, classifier, location, destFile, markerFile and overwrite.) + * See "Usage" and "Javadoc" for details. + * + * @parameter + * @required + * @since 1.0 + */ + private ArrayList artifactItems; + + /** + * Used to look up Artifacts in the remote repository. + * + * @parameter expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}" + * @required + * @readonly + */ + private org.apache.maven.artifact.factory.ArtifactFactory factory; + + /** + * Used to look up Artifacts in the remote repository. + * + * @parameter expression="${component.org.apache.maven.artifact.resolver.ArtifactResolver}" + * @required + * @readonly + */ + private org.apache.maven.artifact.resolver.ArtifactResolver resolver; + + /** + * Artifact collector, needed to resolve dependencies. + * + * @component role="org.apache.maven.artifact.resolver.ArtifactCollector" + * @required + * @readonly + */ + private ArtifactCollector artifactCollector; + + /** + * @component role="org.apache.maven.artifact.metadata.ArtifactMetadataSource" + * hint="maven" + * @required + * @readonly + */ + private ArtifactMetadataSource artifactMetadataSource; + + /** + * Location of the local repository. + * + * @parameter expression="${localRepository}" + * @readonly + * @required + */ + private org.apache.maven.artifact.repository.ArtifactRepository local; + + /** + * List of Remote Repositories used by the resolver + * + * @parameter expression="${project.remoteArtifactRepositories}" + * @readonly + * @required + */ + private java.util.List remoteRepos; + + /** + * To look up Archiver/UnArchiver implementations + * + * @parameter expression="${component.org.codehaus.plexus.archiver.manager.ArchiverManager}" + * @required + * @readonly + */ + private ArchiverManager archiverManager; + + /** + * POM + * + * @parameter expression="${project}" + * @readonly + * @required + */ + private MavenProject project; + + /** + * Contains the full list of projects in the reactor. + * + * @parameter expression="${reactorProjects}" + * @required + * @readonly + */ + private List reactorProjects; + + /** + * If the plugin should be silent. + * + * @optional + * @since 2.0 + * @parameter expression="${silent}" default-value="false" + */ + private boolean silent; + + /** + * Output absolute filename for resolved artifacts + * + * @optional + * @since 2.0 + * @parameter expression="${outputAbsoluteArtifactFilename}" + * default-value="false" + */ + private boolean outputAbsoluteArtifactFilename; + + // Static -------------------------------------------------------- + + // Constructors -------------------------------------------------- + + public DeploySesatWarfilesMojo() { + } + + // Public -------------------------------------------------------- + + // Z implementation ---------------------------------------------- + + // CopyMojo overrides --------------------------------------------------- + + public void execute() throws MojoExecutionException{ + + // pre-condition checks + + // 1. the output directory must exist + if(getOutputDirectory().exists()){ + + // 2. output directory is writable + if(getOutputDirectory().canWrite()){ + + // execute default behaviour + pushFields(); + super.execute(); + + }else{ + // 2.failure output directory isn't writable + getLog().error( getOutputDirectory().getAbsolutePath() + " can not be written to."); + } + }else{ + // 1.failure: the output directory doesn't exist + getLog().error( getOutputDirectory().getAbsolutePath() + " does not exist."); + final String catalinaBase = System.getProperty("env.CATALINA_BASE"); + if(null == catalinaBase || 0 == catalinaBase.length()){ + getLog().info("Define system variable CATALINA_BASE to enable automatic deployment."); + } + } + + + } + + // Package protected --------------------------------------------- + + // Protected ----------------------------------------------------- + + // Private ------------------------------------------------------- + + private void pushFields(){ + setArchiverManager(archiverManager); + setArtifactCollector(artifactCollector); + setArtifactMetadataSource(artifactMetadataSource); + setFactory(factory); + setResolver(resolver); + } + + // Inner classes ------------------------------------------------- + +} Property changes on: trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/war/pom.xml =================================================================== --- trunk/war/pom.xml 2007-11-03 11:09:02 UTC (rev 5866) +++ trunk/war/pom.xml 2007-11-05 14:39:46 UTC (rev 5867) @@ -242,13 +242,12 @@ <activeByDefault>true</activeByDefault> </activation> <build><plugins><plugin> - <!-- TODO extend this into a custom mojo that checks env.CATALINA_BASE is valid --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> + <groupId>sesat</groupId> + <artifactId>sesat-mojo</artifactId> <executions><execution> <id>copy-self</id> <phase>install</phase> - <goals><goal>copy</goal></goals> + <goals><goal>local-deploy</goal></goals> </execution></executions> </plugin></plugins></build> <properties> _______________________________________________ Kernel-commits mailing list Kernel-commits@sesat.no http://sesat.no/mailman/listinfo/kernel-commits