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;
10 import org.apache.maven.plugin.AbstractMojo;
11 import org.apache.maven.plugin.MojoExecutionException;
12 import org.apache.maven.plugin.MojoFailureException;
17 * Delete all Module/ModuleFactory sources
19 * @goal delete-sources
23 public class DeleteSources extends AbstractMojo{
25 * @parameter expression="${project.build.sourceDirectory}"
29 private File directory;
32 public void execute() throws MojoExecutionException, MojoFailureException {
33 if (directory == null || !directory.exists()) {
34 super.getLog().error("Directory does not exists.");
36 File sourceDirectory = new File(directory.getPath() + Util.replaceDots(".org.opendaylight.controller.config.yang.test.impl"));
37 if (sourceDirectory == null || !sourceDirectory.exists()) {
38 super.getLog().error("Source directory does not exists " + sourceDirectory.getPath());
40 File[] sourceFiles = sourceDirectory.listFiles();
41 for (File sourceFile: sourceFiles) {
42 if(sourceFile.getName().endsWith("Module.java") || sourceFile.getName().endsWith("ModuleFactory.java")) {
43 super.getLog().debug("Source file deleted: " + sourceFile.getName());