2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.yang.test.plugin;
11 import org.apache.maven.plugin.AbstractMojo;
12 import org.apache.maven.plugin.MojoExecutionException;
13 import org.apache.maven.plugin.MojoFailureException;
16 * Delete all Module/ModuleFactory sources
18 * @goal delete-sources
22 public class DeleteSources extends AbstractMojo{
24 * @parameter expression="${project.build.sourceDirectory}"
28 private File directory;
31 public void execute() throws MojoExecutionException, MojoFailureException {
32 if (directory == null || !directory.exists()) {
33 super.getLog().error("Directory does not exists.");
35 File sourceDirectory = new File(directory.getPath() + Util.replaceDots(".org.opendaylight.controller.config.yang.test.impl"));
36 if (sourceDirectory == null || !sourceDirectory.exists()) {
37 super.getLog().error(String.format("Source directory does not exists %s", sourceDirectory.getPath()));
39 File[] sourceFiles = sourceDirectory.listFiles();
40 for (File sourceFile: sourceFiles) {
41 if(sourceFile.getName().endsWith("Module.java") || sourceFile.getName().endsWith("ModuleFactory.java")) {
42 super.getLog().debug(String.format("Source file deleted: %s", sourceFile.getName()));