org.nuiton.eugene.plugin.Zargo2Xmi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maven-eugene-plugin Show documentation
Show all versions of maven-eugene-plugin Show documentation
maven plugin to use the eugene library
/* *##%
* EUGene :: Maven plugin
* Copyright (C) 2006 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program 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 General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* ##%*/
package org.nuiton.eugene.plugin;
import java.io.IOException;
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.nuiton.plugin.PluginIOContext;
import org.nuiton.plugin.PluginHelper;
/**
* Extract zipped XMI files from zargo archive.
*
* @author ruchaud
* @version $Revision: 755 $
*
* Last update: $Date: 2009-12-15 00:50:27 +0100 (mar., 15 déc. 2009) $
* by : $Author: tchemit $
*
* @goal zargo2xmi
*/
public class Zargo2Xmi extends EugeneAbstractMojo {
public static final String[] ZARGO_FILE_FILTER = new String[]{"**/*.zargo", "**/*.zuml"};
public static final String[] XMI_FILE_FILTER = new String[]{"*.xmi", "**/*.xmi"};
/**
* Les entrées-sorties du plugin.
*
*
*
* En entrée on demande des répertoires où chercher les fichiers zargo a convertir.
*
* En sortie on demande le répertoire ou extraire les xmi et copier les resources.
*
* Par défaut on a les valeurs suivantes :
*
*
* <zargoResources>
*
* <input>src/main/xmi</input>
*
* <output>target/generated-sources/xmi</ouput>
*
* </zargoResources>
*
*
*
* Note: si {@link #testPhase} est activée, les valeurs par défaut sont :
*
*
* <zargoResources>
*
* <input>src/test/xmi</input>
*
* <output>target/generated-sources/test-xmi</ouput>
*
* <zargoResources>
*
*
* @parameter
* @since 1.0.0-rc-8
*/
protected PluginIOContext zargoResources;
@Override
public void doAction() throws MojoExecutionException, MojoFailureException {
getLog().info("Extract zipped XMI files from zargo archive and copy resources");
getLog().info("Extract zipped XMI files");
try {
PluginHelper.expandFiles(zargoResources, ZARGO_FILE_FILTER, null, XMI_FILE_FILTER, overwrite);
} catch (IOException ex) {
throw new MojoExecutionException("could not expand files for reason " + ex.getMessage(), ex);
}
getLog().info("Copy resources");
try {
PluginHelper.copyFiles(zargoResources, null, ZARGO_FILE_FILTER, overwrite);
} catch (IOException ex) {
throw new MojoExecutionException("could not copy some files for reason " + ex.getMessage(), ex);
}
}
@Override
protected PluginIOContext getResources() {
return zargoResources;
}
@Override
protected PluginIOContext initResources() {
File defaultIn = getFileFromBasedir("src", "main", "xmi");
File defaultOut = getFileFromBasedir("target", "generated-sources", "xmi");
File defaultTestIn = getFileFromBasedir("src", "test", "xmi");
File defaultTestOut = getFileFromBasedir("target", "generated-sources", "test-xmi");
zargoResources = initResources(defaultIn, defaultOut, defaultTestIn, defaultTestOut);
return zargoResources;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy