001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyrighted [year] [name of copyright owner]". 013 * 014 * Copyright 2011 ForgeRock AS 015 * Portions Copyright 2022 Wren Security. 016 */ 017package org.forgerock.i18n.maven; 018 019import java.io.File; 020 021import org.apache.maven.plugins.annotations.LifecyclePhase; 022import org.apache.maven.plugins.annotations.Mojo; 023import org.apache.maven.plugins.annotations.Parameter; 024 025/** 026 * Goal which generates message source files from a one or more property files. 027 */ 028@Mojo(name="generate-test-messages", defaultPhase=LifecyclePhase.GENERATE_TEST_SOURCES, threadSafe=true) 029public final class GenerateTestMessagesMojo extends 030 AbstractGenerateMessagesMojo { 031 032 /** 033 * The target directory in which the source files should be generated. 034 */ 035 @Parameter(defaultValue="${project.build.directory}/generated-test-sources/messages", required=true) 036 private File targetDirectory; 037 038 /** 039 * The resource directory containing the message files. 040 */ 041 @Parameter(defaultValue="${basedir}/src/test/resources", required=true) 042 private File resourceDirectory; 043 044 /** 045 * {@inheritDoc} 046 */ 047 @Override 048 void addNewSourceDirectory(final File targetDirectory) { 049 getMavenProject().addTestCompileSourceRoot( 050 targetDirectory.getAbsolutePath()); 051 } 052 053 /** 054 * {@inheritDoc} 055 */ 056 @Override 057 File getResourceDirectory() { 058 return resourceDirectory; 059 } 060 061 /** 062 * {@inheritDoc} 063 */ 064 @Override 065 File getTargetDirectory() { 066 return targetDirectory; 067 } 068 069}