
de.silpion.opencms.maven.plugins.AbstractImportMojo Maven / Gradle / Ivy
package de.silpion.opencms.maven.plugins;
/*-
* #%L
* OpenCms CmsShell Maven Plugin
* %%
* Copyright (C) 2017 - 2018 Silpion IT-Solutions GmbH (https://www.silpion.de/)
* %%
* 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
* .
* #L%
*/
import de.silpion.opencms.maven.plugins.params.ResourceArtifact;
import de.silpion.opencms.maven.plugins.params.ResourceImport;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Parameter;
import java.io.File;
import java.util.Collections;
import java.util.List;
/**
* @author schrader
*/
public abstract class AbstractImportMojo extends AbstractCmsShellMojo {
@Parameter
private List files = Collections.emptyList();
@Parameter
private List artifacts = Collections.emptyList();
protected List getFiles() {
return files;
}
protected List getArtifacts() {
return artifacts;
}
@Override
protected void validate() throws MojoFailureException {
super.validate();
if (files.isEmpty() && artifacts.isEmpty()) {
throw new MojoFailureException("A file to import must be set");
}
resolveResources(artifacts);
}
protected String getAbsolutePath(File file) {
String path = file.getAbsolutePath();
return path.replace('\\','/');
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy