Skip to content

Getting started

Albert Farré Figueras edited this page Nov 30, 2020 · 4 revisions

To use the copy-source plugin follow the next steps:

1. Add the plugin to your pom

(...)
<build>
   <plugins>
      (...)
      <plugin>
         <groupId>org.bytemechanics.maven</groupId>
         <artifactId>copysource-maven-plugin</artifactId>
         <version>0.1.0-SNAPSHOT</version>
      </plugin>
      (...)
   <(...)/plugins>
</build>
(...)

2. Define the execution goal "copy-classes"

Note: the phase it's not necessary, by default uses "generate-sources"

(...)
<build>
   <plugins>
      (...)
      <plugin>
         <groupId>org.bytemechanics.maven</groupId>
         <artifactId>copysource-maven-plugin</artifactId>
         <version>0.1.0-SNAPSHOT</version>
         <executions>
            <execution>
               <goals>
                  <goal>copy-classes</goal>
               </goals>
            </execution>
         </executions>
      </plugin>
      (...)
   </plugins>
</build>
(...)

3. Configure it with the copies that you want to do

(...)
<build>
   <plugins>
      (...)
      <plugin>
         <groupId>org.bytemechanics.maven</groupId>
         <artifactId>copysource-maven-plugin</artifactId>
         <version>0.1.0-SNAPSHOT</version>
         <executions>
            <execution>
               <goals>
                  <goal>copy-classes</goal>
               </goals>
               <configuration>
                  <copies>
                     <copy>
                        <artifact>[source-groupId]:[source-artifactId]:[source-version]</artifact>
                        <classes>
                           <class>[cannonical-name-of-origin-source. Example:org.bytemechanics.commons.functional.LambdaUnchecker]</class>
                           (...)
                        </classes>
                        <fromPackage>[package-segment-to-replace. Example: org.bytemechanics.commons]</fromPackage>
                        <toPackage>[package-segment-to-replace. Example: org.bytemechanics.standalone.ignite.internal.commons]</toPackage>
                     </copy>
                  </copies>
               </configuration>
            </execution>
         </executions>
      </plugin>
      (...)
   </plugins>
</build>
(...)

Happy copying!