001/* 002 * Copyright (C) 2005 Christian Schulte <cs@schulte.it> 003 * All rights reserved. 004 * 005 * Redistribution and use in source and binary forms, with or without 006 * modification, are permitted provided that the following conditions 007 * are met: 008 * 009 * o Redistributions of source code must retain the above copyright 010 * notice, this list of conditions and the following disclaimer. 011 * 012 * o Redistributions in binary form must reproduce the above copyright 013 * notice, this list of conditions and the following disclaimer in 014 * the documentation and/or other materials provided with the 015 * distribution. 016 * 017 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 018 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 019 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 020 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, 021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 022 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 023 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 024 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 025 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 026 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 027 * 028 * $JOMC: TestClassesCommitMojo.java 5228 2016-04-24 11:08:06Z schulte $ 029 * 030 */ 031package org.jomc.mojo; 032 033import java.io.File; 034import org.apache.maven.plugin.MojoExecutionException; 035import org.apache.maven.plugins.annotations.LifecyclePhase; 036import org.apache.maven.plugins.annotations.Mojo; 037import org.apache.maven.plugins.annotations.Parameter; 038import org.apache.maven.plugins.annotations.ResolutionScope; 039 040/** 041 * Commits model objects to a projects' test classes. 042 * 043 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 044 * @version $JOMC: TestClassesCommitMojo.java 5228 2016-04-24 11:08:06Z schulte $ 045 */ 046@Mojo( name = "commit-test-classes", 047 defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES, 048 requiresDependencyResolution = ResolutionScope.TEST, 049 threadSafe = true ) 050public final class TestClassesCommitMojo extends AbstractClassesCommitMojo 051{ 052 053 /** 054 * Execution strategy of the goal ({@code always} or {@code once-per-session}). 055 * 056 * @since 1.1 057 */ 058 @Parameter( name = "commitTestClassesExecutionStrategy", 059 property = "jomc.commitTestClassesExecutionStrategy", 060 defaultValue = "once-per-session" ) 061 private String commitTestClassesExecutionStrategy; 062 063 /** 064 * Creates a new {@code TestClassesCommitMojo} instance. 065 */ 066 public TestClassesCommitMojo() 067 { 068 super(); 069 } 070 071 @Override 072 protected String getClassesModuleName() throws MojoExecutionException 073 { 074 return this.getTestModuleName(); 075 } 076 077 @Override 078 protected ClassLoader getClassesClassLoader() throws MojoExecutionException 079 { 080 return this.getTestClassLoader(); 081 } 082 083 @Override 084 protected File getClassesDirectory() throws MojoExecutionException 085 { 086 return this.getTestOutputDirectory(); 087 } 088 089 @Override 090 protected String getGoal() throws MojoExecutionException 091 { 092 return "commit-test-classes"; 093 } 094 095 @Override 096 protected String getExecutionStrategy() throws MojoExecutionException 097 { 098 return this.commitTestClassesExecutionStrategy; 099 } 100 101}