Add buck Yang plugin

Change-Id: I1bb6a47a81fc05eabe744fd5032fc165aa0a9b55
diff --git a/parser/pom.xml b/parser/pom.xml
index 82106fd..2a876f7 100644
--- a/parser/pom.xml
+++ b/parser/pom.xml
@@ -40,11 +40,6 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.maven</groupId>
-            <artifactId>maven-project</artifactId>
-            <version>3.0-alpha-2</version>
-        </dependency>
-        <dependency>
             <groupId>org.antlr</groupId>
             <artifactId>antlr4-runtime</artifactId>
             <version>4.5.3</version>
diff --git a/parser/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java b/parser/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java
index df1dcad..65d054c 100644
--- a/parser/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java
+++ b/parser/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java
@@ -16,9 +16,17 @@
 
 package org.onosproject.yangutils.parser.impl.parserutils;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Pattern;
+
 import org.antlr.v4.runtime.ParserRuleContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.onosproject.yangutils.datamodel.YangAtomicPath;
 import org.onosproject.yangutils.datamodel.YangImport;
 import org.onosproject.yangutils.datamodel.YangLeaf;
@@ -36,16 +44,6 @@
 import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
 import org.onosproject.yangutils.parser.exceptions.ParserException;
 
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.regex.Pattern;
-
 import static org.onosproject.yangutils.datamodel.YangPathArgType.ABSOLUTE_PATH;
 import static org.onosproject.yangutils.datamodel.YangPathArgType.RELATIVE_PATH;
 import static org.onosproject.yangutils.datamodel.YangPathOperator.EQUALTO;
@@ -83,7 +81,6 @@
     private static final String ONE = "1";
     private static final int IDENTIFIER_LENGTH = 64;
     private static final String DATE_FORMAT = "yyyy-MM-dd";
-    private static final Log log = LogFactory.getLog(ListenerUtil.class);
 
     /**
      * Creates a new listener util.
@@ -998,8 +995,8 @@
                 + errorInfo);
         parserException.setLine(ctx.getStart().getLine());
         parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
-        log.info(parserException.getMessage() + " at position " + parserException.getCharPositionInLine() +
-                         " in line " + parserException.getLineNumber() + " of yang file " + fileName);
+        //FIXME this exception should probably be thrown rather than just logged
+        //throw parserException;
     }
 
     /**
diff --git a/plugin/buck/pom.xml b/plugin/buck/pom.xml
new file mode 100644
index 0000000..fc1628b
--- /dev/null
+++ b/plugin/buck/pom.xml
@@ -0,0 +1,62 @@
+<!--
+  ~ Copyright 2016-present Open Networking Laboratory
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-yang-plugins</artifactId>
+        <version>1.9-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yang-buck-plugin</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>buck-api</artifactId>
+            <version>0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>2.4.3</version>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <artifactSet>
+                        <excludes>
+                            <exclude>com.google.guava:guava</exclude>
+                        </excludes>
+                    </artifactSet>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangGenerator.java b/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangGenerator.java
new file mode 100644
index 0000000..583ecaf
--- /dev/null
+++ b/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangGenerator.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.plugin.buck;
+
+import java.io.File;
+import java.util.List;
+
+import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
+import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil;
+import org.onosproject.yangutils.utils.io.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.YangNode;
+
+/**
+ * Generates Java sources from a Yang model.
+ */
+public class YangGenerator {
+
+    private final List<File> models;
+    private String outputDirectory;
+
+    public YangGenerator(List<File> models, String outputDirectory) {
+        this.models = models;
+        this.outputDirectory = outputDirectory + "/";
+    }
+
+    public void execute() throws YangParsingException {
+        for (File model : models) {
+            try {
+                YangPluginConfig config = new YangPluginConfig();
+                config.setCodeGenDir(outputDirectory);
+
+                YangNode yangNode = new YangUtilsParserManager()
+                        .getDataModel(model.toString());
+
+                JavaCodeGeneratorUtil.generateJavaCode(yangNode, config);
+            } catch (Exception e) {
+                throw new YangParsingException(e);
+            }
+        }
+    }
+
+}
diff --git a/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangLibrary.java b/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangLibrary.java
new file mode 100644
index 0000000..8db806b
--- /dev/null
+++ b/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangLibrary.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.plugin.buck;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.annotation.Nullable;
+
+import com.facebook.buck.jvm.java.JarDirectoryStep;
+import com.facebook.buck.model.BuildTargets;
+import com.facebook.buck.rules.AbstractBuildRule;
+import com.facebook.buck.rules.AddToRuleKey;
+import com.facebook.buck.rules.BuildContext;
+import com.facebook.buck.rules.BuildRuleParams;
+import com.facebook.buck.rules.BuildableContext;
+import com.facebook.buck.rules.SourcePath;
+import com.facebook.buck.rules.SourcePathResolver;
+import com.facebook.buck.step.Step;
+import com.facebook.buck.step.fs.MakeCleanDirectoryStep;
+import com.facebook.buck.step.fs.MkdirStep;
+import com.facebook.buck.step.fs.RmStep;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSortedSet;
+
+/**
+ * Buck rule to define a library built form a Yang model.
+ */
+public class YangLibrary extends AbstractBuildRule {
+
+    @AddToRuleKey
+    private final ImmutableSortedSet<SourcePath> srcs;
+    
+    private final Path genSrcsDirectory;
+    private final Path outputDirectory;
+    private final Path output;
+
+    public YangLibrary(
+            BuildRuleParams params,
+            SourcePathResolver resolver,
+            ImmutableSortedSet<SourcePath> srcs) {
+        super(params, resolver);
+        this.srcs = srcs;
+
+        genSrcsDirectory = BuildTargets.getGenPath(getProjectFilesystem(),
+                                                   params.getBuildTarget(),
+                                                   "%s__yang-gen");
+        outputDirectory = BuildTargets.getGenPath(getProjectFilesystem(),
+                                                  params.getBuildTarget(),
+                                                  "%s__yang-output");
+        output = Paths.get(String.format("%s/%s-sources.jar",
+                                         outputDirectory,
+                                         params.getBuildTarget().getShortNameAndFlavorPostfix()));
+    }
+
+    @Override
+    public ImmutableList<Step> getBuildSteps(BuildContext buildContext, BuildableContext buildableContext) {
+        ImmutableList.Builder<Step> steps = ImmutableList.builder();
+
+        // Delete the old output for this rule, if it exists.
+        steps.add(
+                new RmStep(
+                        getProjectFilesystem(),
+                        getPathToOutput(),
+                        /* shouldForceDeletion */ true,
+                        /* shouldRecurse */ true));
+
+        // Make sure that the directory to contain the output file exists. Rules get output to a
+        // directory named after the base path, so we don't want to nuke the entire directory.
+        steps.add(new MkdirStep(getProjectFilesystem(), outputDirectory));
+
+        steps.add(new MakeCleanDirectoryStep(getProjectFilesystem(), genSrcsDirectory));
+
+        List<Path> sourcePaths = srcs.stream()
+                .map(s -> getResolver().getRelativePath(s))
+                .collect(Collectors.toList());
+
+        steps.add(new YangStep(getProjectFilesystem(), sourcePaths, genSrcsDirectory));
+
+        steps.add(new JarDirectoryStep(
+                getProjectFilesystem(),
+                output,
+                ImmutableSortedSet.of(genSrcsDirectory),
+                null,
+                null));
+
+        return steps.build();
+    }
+
+    @Nullable
+    @Override
+    public Path getPathToOutput() {
+        return output;
+    }
+}
diff --git a/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangLibraryDescription.java b/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangLibraryDescription.java
new file mode 100644
index 0000000..dfbdd3c
--- /dev/null
+++ b/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangLibraryDescription.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.plugin.buck;
+
+import java.nio.file.Path;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import com.facebook.buck.cli.BuckConfig;
+import com.facebook.buck.jvm.java.CalculateAbi;
+import com.facebook.buck.jvm.java.DefaultJavaLibrary;
+import com.facebook.buck.jvm.java.JavaBuckConfig;
+import com.facebook.buck.jvm.java.JavaOptions;
+import com.facebook.buck.jvm.java.JavacOptions;
+import com.facebook.buck.jvm.java.JavacOptionsAmender;
+import com.facebook.buck.jvm.java.JavacOptionsFactory;
+import com.facebook.buck.jvm.java.JavacToJarStepFactory;
+import com.facebook.buck.jvm.java.JvmLibraryArg;
+import com.facebook.buck.model.BuildTarget;
+import com.facebook.buck.model.BuildTargets;
+import com.facebook.buck.model.Flavor;
+import com.facebook.buck.model.Flavored;
+import com.facebook.buck.model.ImmutableFlavor;
+import com.facebook.buck.model.UnflavoredBuildTarget;
+import com.facebook.buck.parser.NoSuchBuildTargetException;
+import com.facebook.buck.rules.BuildRule;
+import com.facebook.buck.rules.BuildRuleParams;
+import com.facebook.buck.rules.BuildRuleResolver;
+import com.facebook.buck.rules.BuildRuleType;
+import com.facebook.buck.rules.BuildTargetSourcePath;
+import com.facebook.buck.rules.Description;
+import com.facebook.buck.rules.SourcePath;
+import com.facebook.buck.rules.SourcePathResolver;
+import com.facebook.buck.rules.SourcePaths;
+import com.facebook.buck.rules.TargetGraph;
+import com.google.common.base.Optional;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSortedSet;
+
+/**
+ * Description of a Buck Yang Library.
+ */
+public class YangLibraryDescription
+        implements Description<YangLibraryDescription.Arg>, Flavored {
+    public static final BuildRuleType TYPE = BuildRuleType.of("yang_library");
+    public static final Flavor SOURCES = ImmutableFlavor.of("srcs");
+
+    private final JavacOptions defaultJavacOptions;
+    private final JavaOptions defaultJavaOptions;
+
+    public YangLibraryDescription(BuckConfig config) {
+        JavaBuckConfig javaConfig = new JavaBuckConfig(config);
+        defaultJavacOptions = javaConfig.getDefaultJavacOptions();
+        defaultJavaOptions = javaConfig.getDefaultJavaOptions();
+    }
+
+    @Override
+    public BuildRuleType getBuildRuleType() {
+        return TYPE;
+    }
+
+    @Override
+    public Arg createUnpopulatedConstructorArg() {
+        return new Arg();
+    }
+
+    @Override
+    public <A extends Arg> BuildRule createBuildRule(TargetGraph targetGraph,
+                                                     BuildRuleParams params,
+                                                     BuildRuleResolver resolver,
+                                                     A args)
+            throws NoSuchBuildTargetException {
+
+        SourcePathResolver pathResolver = new SourcePathResolver(resolver);
+
+        UnflavoredBuildTarget unflavoredBuildTarget =
+                params.getBuildTarget().getUnflavoredBuildTarget();
+        BuildRuleParams yangParams = params.copyWithBuildTarget(
+                BuildTargets.createFlavoredBuildTarget(
+                        unflavoredBuildTarget, SOURCES));
+
+        BuildRule yangLib = resolver.addToIndex(new YangLibrary(yangParams, pathResolver, args.srcs));
+
+        if (params.getBuildTarget().getFlavors().contains(SOURCES)) {
+            return yangLib;
+        }
+
+        JavacOptions javacOptions = JavacOptionsFactory.create(
+                defaultJavacOptions,
+                params,
+                resolver,
+                pathResolver,
+                args
+        );
+
+
+        // Create to main compile rule.
+        BuildRuleParams javaParams = params.copyWithChanges(
+                params.getBuildTarget(),
+                Suppliers.ofInstance(
+                        ImmutableSortedSet.<BuildRule>naturalOrder()
+                                .add(yangLib)
+//                                .addAll(deps)
+                                //FIXME remove when we figure out compile time deps
+                                .addAll((args.deps.or(ImmutableSortedSet.<BuildTarget>of())).stream().map(resolver::getRule).collect(Collectors.toList()))
+//                                .addAll(BuildRules.getExportedRules(deps))
+                                .addAll(pathResolver.filterBuildRuleInputs(javacOptions.getInputs(pathResolver)))
+                                .build()),
+                Suppliers.ofInstance(ImmutableSortedSet.<BuildRule>of()));
+
+        BuildTarget abiJarTarget = params.getBuildTarget().withAppendedFlavors(CalculateAbi.FLAVOR);
+
+        DefaultJavaLibrary library =
+                resolver.addToIndex(
+                        new DefaultJavaLibrary(
+                                javaParams,
+                                pathResolver,
+                                ImmutableSet.of(SourcePaths.getToBuildTargetSourcePath().apply(yangLib)),
+                                /* resources */ ImmutableSet.<SourcePath>of(),
+                                javacOptions.getGeneratedSourceFolderName(),
+                                /* proguardConfig */ Optional.<SourcePath>absent(),
+                                /* postprocessClassesCommands */ ImmutableList.<String>of(),
+                                /* exportedDeps */ ImmutableSortedSet.<BuildRule>of(),
+                                /* providedDeps */ ImmutableSortedSet.<BuildRule>of(),
+                                /* abiJar */ new BuildTargetSourcePath(abiJarTarget),
+                                javacOptions.trackClassUsage(),
+                                /* additionalClasspathEntries */ ImmutableSet.<Path>of(),
+                                new JavacToJarStepFactory(javacOptions, JavacOptionsAmender.IDENTITY),
+                                /* resourcesRoot */ Optional.<Path>absent(),
+                                /* mavenCoords */ Optional.<String>absent(),
+                                /* tests */ ImmutableSortedSet.<BuildTarget>of(),
+                                /* classesToRemoveFromJar */ ImmutableSet.<Pattern>of()));
+
+        resolver.addToIndex(
+                CalculateAbi.of(
+                        abiJarTarget,
+                        pathResolver,
+                        params,
+                        new BuildTargetSourcePath(library.getBuildTarget())));
+
+        return library;
+    }
+
+    @Override
+    public boolean hasFlavors(ImmutableSet<Flavor> flavors) {
+        return flavors.isEmpty() || flavors.contains(SOURCES);
+    }
+
+    public static class Arg extends JvmLibraryArg {
+        public ImmutableSortedSet<SourcePath> srcs;
+        public Optional<ImmutableSortedSet<BuildTarget>> deps;
+
+        //TODO other params here
+    }
+}
diff --git a/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangParsingException.java b/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangParsingException.java
new file mode 100644
index 0000000..da1765b
--- /dev/null
+++ b/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangParsingException.java
@@ -0,0 +1,16 @@
+package org.onosproject.yangutils.plugin.buck;
+
+/**
+ * Used to signal a problem parsing a Yang model.
+ */
+public class YangParsingException extends Exception {
+
+    /**
+     * Creates a YangParsingException based on another exception.
+     * @param t exception from the parser
+     */
+    public YangParsingException (Throwable t) {
+        super(t);
+    }
+
+}
diff --git a/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangStep.java b/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangStep.java
new file mode 100644
index 0000000..ae84cc3
--- /dev/null
+++ b/plugin/buck/src/main/java/org/onosproject/yangutils/plugin/buck/YangStep.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yangutils.plugin.buck;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import com.facebook.buck.io.ProjectFilesystem;
+import com.facebook.buck.step.AbstractExecutionStep;
+import com.facebook.buck.step.ExecutionContext;
+import com.facebook.buck.step.StepExecutionResult;
+
+/**
+ * Buck build step to trigger Yang Java source file generation.
+ */
+public class YangStep extends AbstractExecutionStep {
+
+    private static final String DESCRIPTION = "yang-compile";
+
+    private final ProjectFilesystem filesystem;
+    private final List<Path> srcs;
+    private final Path output;
+
+    YangStep(ProjectFilesystem filesystem,
+             List<Path> srcs,
+             Path genSourcesDirectory) {
+        super(DESCRIPTION);
+        this.filesystem = filesystem;
+        this.srcs = srcs;
+        this.output = genSourcesDirectory;
+    }
+
+    @Override
+    public StepExecutionResult execute(ExecutionContext executionContext)
+            throws IOException, InterruptedException {
+
+        List<File> sourceFiles = srcs.stream().map(Path::toFile)
+                .collect(Collectors.toList());
+
+        try {
+            new YangGenerator(sourceFiles, output.toString()).execute();
+            return StepExecutionResult.SUCCESS;
+        } catch(YangParsingException e) {
+            executionContext.getConsole().printErrorText(e.getMessage());
+            return StepExecutionResult.ERROR;
+        }
+    }
+}
diff --git a/plugin/maven/pom.xml b/plugin/maven/pom.xml
index 9acae97..b2039b9 100644
--- a/plugin/maven/pom.xml
+++ b/plugin/maven/pom.xml
@@ -83,6 +83,12 @@
             <version>1.7.21</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/plugin/pom.xml b/plugin/pom.xml
index 0882556..f35583d 100644
--- a/plugin/pom.xml
+++ b/plugin/pom.xml
@@ -33,6 +33,7 @@
 
     <modules>
         <module>maven</module>
+        <module>buck</module>
     </modules>
 
     <dependencies>
@@ -52,28 +53,6 @@
             <version>${project.version}</version>
         </dependency>
     </dependencies>
-
-    <build>
-        <pluginManagement>
-            <plugins>
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-compiler-plugin</artifactId>
-                    <version>3.5.1</version>
-                    <configuration>
-                        <source>1.8</source>
-                        <target>1.8</target>
-                    </configuration>
-
-                </plugin>
-                <plugin>
-                    <groupId>org.apache.felix</groupId>
-                    <artifactId>maven-bundle-plugin</artifactId>
-                    <version>2.3.7</version>
-                </plugin>
-            </plugins>
-        </pluginManagement>
-    </build>
 </project>
 
 
diff --git a/pom.xml b/pom.xml
index 6806e4e..2978ee5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,6 +39,19 @@
         <module>plugin</module>
     </modules>
 
+    <!-- FIXME this can be removed if/when buck-api is released -->
+    <repositories>
+        <repository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>daily</updatePolicy>
+                <checksumPolicy>fail</checksumPolicy>
+            </snapshots>
+        </repository>
+    </repositories>
+
     <dependencies>
         <dependency>
             <groupId>com.google.guava</groupId>
@@ -52,21 +65,10 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.12</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.hamcrest</groupId>
             <artifactId>hamcrest-all</artifactId>
             <version>1.3</version>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <version>1.7.21</version>
-            <scope>provided</scope>
+            <scope>test</scope>
         </dependency>
     </dependencies>