mirror of https://github.com/apache/maven.git
o Decoupled it0115 from production deps/plugins
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@735055 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ef13ff926e
commit
d555e50cc9
|
@ -28,35 +28,27 @@ public class MavenIT0115CustomArtifactHandlerAndCustomLifecycleTest
|
|||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
|
||||
public MavenIT0115CustomArtifactHandlerAndCustomLifecycleTest() {
|
||||
super( "(2.0.1,2.0.5),(2.0.6,2.99.99)" );//extension support removed from 3.0
|
||||
public MavenIT0115CustomArtifactHandlerAndCustomLifecycleTest()
|
||||
{
|
||||
super( "(2.0.1,2.0.5),(2.0.6,2.99.99)" ); //extension support removed from 3.0
|
||||
}
|
||||
|
||||
public void testit0115()
|
||||
/**
|
||||
* Test the use of a custom lifecycle from a plugin that is defined as a build extension.
|
||||
*/
|
||||
public void testitMNG2831()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0115" );
|
||||
|
||||
Verifier verifier;
|
||||
|
||||
// Install the parent POM
|
||||
verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.deleteArtifact( "org.apache.maven.its.it0115", "test-extension", "1.0-SNAPSHOT", "jar" );
|
||||
verifier.deleteArtifact( "org.apache.maven.its.it0115", "test-project", "1.0-SNAPSHOT", "jar" );
|
||||
|
||||
// Install the plugin to test for Authz info in the WagonManager
|
||||
verifier = new Verifier( new File( testDir.getAbsolutePath(), "test-extension" ).getAbsolutePath() );
|
||||
verifier.executeGoal( "install" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
// Build the test project that uses the plugin.
|
||||
File testProject = new File( testDir.getAbsolutePath(), "test-project" );
|
||||
verifier = new Verifier( testProject.getAbsolutePath() );
|
||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteDirectory( "target" );
|
||||
verifier.executeGoal( "package" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
verifier.assertFilePresent( new File( testProject, "target/test-project.xar" ).getAbsolutePath() );
|
||||
verifier.assertFilePresent( "target/test-1.0-it.jar" );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you 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>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.maven.its.mng2831</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>1.0</version>
|
||||
<!-- The packaging defined by the IT plugin -->
|
||||
<packaging>it-packaging</packaging>
|
||||
|
||||
<name>Maven Integration Test :: MNG-2831</name>
|
||||
<description>
|
||||
Test the use of a custom lifecycle from a plugin that is defined as a build extension.
|
||||
</description>
|
||||
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-packaging</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
</project>
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.its.it0115</groupId>
|
||||
<artifactId>test-extension</artifactId>
|
||||
<name>Test Extension</name>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<inceptionYear>2007</inceptionYear>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-archiver</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,80 +0,0 @@
|
|||
package org.apache.maven.its.it0115;
|
||||
|
||||
/*
|
||||
* Copyright 2007 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 java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.archiver.ArchiverException;
|
||||
import org.codehaus.plexus.archiver.zip.ZipArchiver;
|
||||
|
||||
/**
|
||||
* Gather all resources in a XAR file (which is actually a ZIP file)
|
||||
*
|
||||
* @version $Id$
|
||||
* @goal xar
|
||||
* @phase package
|
||||
*/
|
||||
public class XarMojo extends AbstractMojo
|
||||
{
|
||||
/**
|
||||
* The maven project.
|
||||
*
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.plugin.Mojo#execute()
|
||||
*/
|
||||
public void execute() throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
if (this.project.getResources().size() < 1)
|
||||
{
|
||||
this.getLog().warn("No XAR created as no resources were found");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
performArchive();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new MojoExecutionException("Error while creating XAR file", e );
|
||||
}
|
||||
}
|
||||
|
||||
private void performArchive() throws ArchiverException, IOException
|
||||
{
|
||||
File xarFile = new File(this.project.getBuild().getDirectory(),
|
||||
this.project.getArtifactId() + ".xar" );
|
||||
ZipArchiver archiver = new ZipArchiver();
|
||||
archiver.setDestFile(xarFile);
|
||||
archiver.setIncludeEmptyDirs(false);
|
||||
archiver.setCompress(true);
|
||||
archiver.addDirectory(new File(this.project.getBuild().getOutputDirectory()));
|
||||
archiver.createArchive();
|
||||
this.project.getArtifact().setFile(xarFile);
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<component-set>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
|
||||
<role-hint>xar</role-hint>
|
||||
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
|
||||
<configuration>
|
||||
<phases>
|
||||
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
|
||||
<package>org.apache.maven.its.it0115:test-extension:xar</package>
|
||||
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
|
||||
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
|
||||
</phases>
|
||||
</configuration>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
|
||||
<role-hint>xar</role-hint>
|
||||
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
|
||||
<configuration>
|
||||
<type>xar</type>
|
||||
<extension>xar</extension>
|
||||
<packaging>xar</packaging>
|
||||
</configuration>
|
||||
</component>
|
||||
</components>
|
||||
</component-set>
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.its.it0115</groupId>
|
||||
<artifactId>test-project</artifactId>
|
||||
<name>Test Project</name>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<inceptionYear>2007</inceptionYear>
|
||||
|
||||
<packaging>xar</packaging>
|
||||
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.its.it0115</groupId>
|
||||
<artifactId>test-extension</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<package>
|
||||
<infos>
|
||||
<name>Backup</name>
|
||||
<description>on Fri Jan 26 09:55:02 CET 2007 by XWiki.Admin</description>
|
||||
<licence></licence>
|
||||
<author>XWiki.Admin</author>
|
||||
<version></version>
|
||||
<backupPack>true</backupPack>
|
||||
</infos>
|
||||
<files/>
|
||||
</package>
|
Loading…
Reference in New Issue