+
+ <plugin>
+ <groupId>com.alexecollins.maven.plugin</groupId>
+ <artifactId>script-maven-plugin</artifactId>
+ <version>1.0.0</version>
+ <executions>
+ <execution>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <script>
+ // BeanShell is 2005-ish and thus doesn't support generics, varargs, try-with-resources or lambdas, so:
+ // (If we do this kind of inline code in pom.xml more often, we shold have a new simple module in
+ // odl-parent, which has *.java that we compile, and then just depend on it here and call one-line
+ // static class methods only - it will be MUCH easier to write!)
+ void copy(File root, String glob, File target) {
+ java.nio.file.DirectoryStream dirStream = java.nio.file.Files.newDirectoryStream(root.toPath(), glob);
+ Iterator dirStreamIterator = dirStream.iterator();
+ while (dirStreamIterator.hasNext()) {
+ java.nio.file.Path path = dirStreamIterator.next();
+ java.nio.file.Files.copy(path, new File(target, path.toFile().getName()).toPath(),
+ new java.nio.file.CopyOption[] {
+ java.nio.file.StandardCopyOption.REPLACE_EXISTING,
+ java.nio.file.StandardCopyOption.COPY_ATTRIBUTES
+ }
+ );
+ }
+ dirStream.close();
+ }
+
+ File gitRepoRootDir = project.basedir;
+ while (!new File(gitRepoRootDir, ".git").exists() && gitRepoRootDir.getParentFile() != null) {
+ gitRepoRootDir = gitRepoRootDir.getParentFile();
+ }
+
+ File target = new File(project.build.outputDirectory);
+ target.mkdirs();
+ copy(gitRepoRootDir, "README*", target);
+ copy(gitRepoRootDir, "CONTRIBUTING*", target);
+ copy(gitRepoRootDir, "PROJECT_INFO.yaml", target);
+ </script>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache-extras.beanshell</groupId>
+ <artifactId>bsh</artifactId>
+ <version>2.0b6</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ <!-- Blueprint dependency injection -->
+ <!-- Remove when upgrading to plugin 1.5.0, and use
+ <configuration><generatedDir>org/opendaylight/blueprint/</...></...> -->
+ <!-- See https://issues.apache.org/jira/browse/ARIES-1597 -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <!-- This should only run once, in the process-classes phase; but we need it to run after
+ process-classes in child projects. Attaching to process-test-classes and prepare-package
+ ensures that the file will be moved whether tests are skipped or not. -->
+ <execution>
+ <id>move-autowire-test</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <echo>Moving autowire.xml to org/opendaylight/blueprint</echo>
+ <move file="${basedir}/target/generated-resources/OSGI-INF/blueprint/autowire.xml"
+ todir="${basedir}/target/generated-resources/org/opendaylight/blueprint"
+ failonerror="false" quiet="true" />
+ </target>
+ </configuration>
+ </execution>
+ <execution>
+ <id>move-autowire-package</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <echo>Moving autowire.xml to org/opendaylight/blueprint</echo>
+ <move file="${basedir}/target/generated-resources/OSGI-INF/blueprint/autowire.xml"
+ todir="${basedir}/target/generated-resources/org/opendaylight/blueprint"
+ failonerror="false" quiet="true" />
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>