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: TestModuleAttachMojo.java 5228 2016-04-24 11:08:06Z schulte $
029 *
030 */
031package org.jomc.mojo;
032
033import java.io.File;
034import org.apache.maven.plugins.annotations.LifecyclePhase;
035import org.apache.maven.plugins.annotations.Mojo;
036import org.apache.maven.plugins.annotations.Parameter;
037
038/**
039 * Attaches a project's test module artifact.
040 *
041 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
042 * @version $JOMC: TestModuleAttachMojo.java 5228 2016-04-24 11:08:06Z schulte $
043 */
044@Mojo( name = "attach-test-module",
045       defaultPhase = LifecyclePhase.PROCESS_TEST_RESOURCES )
046public final class TestModuleAttachMojo extends AbstractAttachMojo
047{
048
049    /**
050     * File of the attached module artifact.
051     */
052    @Parameter( name = "testModuleArtifactFile",
053                property = "jomc.testModuleArtifactFile",
054                defaultValue = "${project.build.testOutputDirectory}/META-INF/jomc.xml" )
055    private File testModuleArtifactFile;
056
057    /**
058     * Classifier of the attached module artifact.
059     */
060    @Parameter( name = "testModuleArtifactClassifier",
061                property = "jomc.testModuleArtifactClassifier",
062                defaultValue = "jomc-test-module" )
063    private String testModuleArtifactClassifier;
064
065    /**
066     * Type of the attached module artifact.
067     */
068    @Parameter( name = "testModuleArtifactType",
069                property = "jomc.testModuleArtifactType",
070                defaultValue = "xml" )
071    private String testModuleArtifactType;
072
073    /**
074     * Execution strategy of the goal ({@code always} or {@code once-per-session}).
075     *
076     * @since 1.1
077     */
078    @Parameter( name = "attachTestModuleExecutionStrategy",
079                property = "jomc.attachTestModuleExecutionStrategy",
080                defaultValue = "once-per-session" )
081    private String attachTestModuleExecutionStrategy;
082
083    /**
084     * Creates a new {@code TestModuleAttachMojo} instance.
085     */
086    public TestModuleAttachMojo()
087    {
088        super();
089    }
090
091    @Override
092    protected File getArtifactFile()
093    {
094        return this.testModuleArtifactFile;
095    }
096
097    @Override
098    protected String getArtifactClassifier()
099    {
100        return this.testModuleArtifactClassifier;
101    }
102
103    @Override
104    protected String getArtifactType()
105    {
106        return this.testModuleArtifactType;
107    }
108
109    @Override
110    protected String getExecutionStrategy()
111    {
112        return this.attachTestModuleExecutionStrategy;
113    }
114
115}