├── .gitignore ├── LICENSE ├── README.md ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── coderplus │ │ └── plugins │ │ ├── CopyMojo.java │ │ ├── FileSet.java │ │ └── RenameMojo.java └── resources │ └── META-INF │ └── m2e │ └── lifecycle-mapping-metadata.xml └── site ├── apt ├── index.apt └── usage.apt.vm └── site.xml /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | release.properties 7 | .project 8 | .classpath 9 | .settings/ 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | copy-rename-maven-plugin 2 | =================== 3 | 4 | The copy-rename-maven-plugin helps in copying files or renaming files or directories during the Maven build lifecycle. 5 | 6 | [![Build Status](https://buildhive.cloudbees.com/job/coderplus/job/copy-rename-maven-plugin/badge/icon)](https://buildhive.cloudbees.com/job/coderplus/job/copy-rename-maven-plugin/) 7 | 8 | 9 | ### How do I use it? ### 10 | 11 | Head over to the [Project Website](http://coderplus.github.io/copy-rename-maven-plugin/) for usage instructions 12 | 13 | ### How can I help the project? ### 14 | 15 | Thanks for asking... 16 | 17 | * If you use this plugin 18 | * Test this out. [File an issue](https://github.com/coderplus/copy-rename-maven-plugin/issues) if it doesn't work for you. File an issue if you think it should do something more, or something different. 19 | * If you would like to contribute 20 | * Do let me know and you can always fork the project. 21 | 22 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | org.sonatype.oss 8 | oss-parent 9 | 9 10 | 11 | 12 | com.coderplus.maven.plugins 13 | copy-rename-maven-plugin 14 | 1.1-SNAPSHOT 15 | maven-plugin 16 | 17 | Copy Rename Maven Plugin 18 | http://coderplus.github.io/copy-rename-maven-plugin 19 | This plugin helps in copying files or renaming files or directories during the Maven build lifecycle. 20 | 2014 21 | 22 | 23 | 24 | MIT License 25 | http://www.opensource.org/licenses/mit-license.php 26 | repo 27 | 28 | 29 | 30 | 31 | 32 | Aneesh Joseph 33 | admin@coderplus.com 34 | 35 | Developer 36 | 37 | 38 | 39 | 40 | 41 | 2.0.9 42 | 3.2 43 | 1.5 44 | 1.5 45 | 46 | 47 | 48 | ${maven.version} 49 | 50 | 51 | 52 | scm:git:git@github.com:coderplus/copy-rename-maven-plugin.git 53 | scm:git:git@github.com:coderplus/copy-rename-maven-plugin.git 54 | scm:git:git@github.com:coderplus/copy-rename-maven-plugin.git 55 | 56 | 57 | 58 | https://github.com/coderplus/m2e-maven-dependency-plugin/issues 59 | 60 | 61 | 62 | 63 | 64 | org.apache.maven 65 | maven-model 66 | ${maven.version} 67 | 68 | 69 | org.apache.maven 70 | maven-project 71 | ${maven.version} 72 | 73 | 74 | org.apache.maven 75 | maven-core 76 | ${maven.version} 77 | 78 | 79 | org.apache.maven 80 | maven-plugin-api 81 | ${maven.version} 82 | 83 | 84 | org.apache.maven 85 | maven-artifact 86 | ${maven.version} 87 | 88 | 89 | org.apache.maven.plugin-tools 90 | maven-plugin-annotations 91 | ${maven.plugin.plugin.version} 92 | provided 93 | 94 | 95 | org.codehaus.plexus 96 | plexus-utils 97 | 1.5.8 98 | 99 | 100 | org.sonatype.plexus 101 | plexus-build-api 102 | 0.0.7 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | org.apache.maven.plugins 111 | maven-plugin-plugin 112 | ${maven.plugin.plugin.version} 113 | 114 | 115 | 116 | 117 | 118 | org.apache.maven.plugins 119 | maven-plugin-plugin 120 | 121 | true 122 | 123 | 124 | 125 | mojo-descriptor 126 | 127 | descriptor 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | org.apache.maven.plugins 139 | maven-plugin-plugin 140 | ${maven.plugin.plugin.version} 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /src/main/java/com/coderplus/plugins/CopyMojo.java: -------------------------------------------------------------------------------- 1 | package com.coderplus.plugins; 2 | 3 | /* 4 | * The MIT License 5 | * 6 | * Copyright (c) 2004 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | 27 | import java.io.File; 28 | import java.io.IOException; 29 | import java.util.List; 30 | 31 | import org.apache.maven.plugin.AbstractMojo; 32 | import org.apache.maven.plugin.MojoExecutionException; 33 | import org.apache.maven.plugins.annotations.Component; 34 | import org.apache.maven.plugins.annotations.LifecyclePhase; 35 | import org.apache.maven.plugins.annotations.Mojo; 36 | import org.apache.maven.plugins.annotations.Parameter; 37 | import org.apache.maven.project.MavenProject; 38 | import org.sonatype.plexus.build.incremental.BuildContext; 39 | import org.codehaus.plexus.util.FileUtils; 40 | 41 | 42 | /** 43 | * Copy files during build 44 | * 45 | * @author Aneesh Joseph 46 | * @since 1.0 47 | */ 48 | @Mojo( name = "copy", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true ) 49 | public class CopyMojo 50 | extends AbstractMojo 51 | { 52 | /** 53 | * The file which has to be copied 54 | * 55 | * @since 1.0 56 | */ 57 | @Parameter( required = false ) 58 | private File sourceFile; 59 | /** 60 | * The target file to which the file should be copied(this shouldn't be a directory but a file which does or does not exist) 61 | * 62 | * @since 1.0 63 | */ 64 | @Parameter( required = false ) 65 | private File destinationFile; 66 | 67 | /** 68 | * Collection of FileSets to work on (FileSet contains sourceFile and destinationFile). See Usage for details. 69 | * 70 | * @since 1.0 71 | */ 72 | @Parameter( required = false ) 73 | private List fileSets; 74 | 75 | /** 76 | * Overwrite files 77 | * 78 | * @since 1.0 79 | */ 80 | @Parameter( property = "copy.overWrite", defaultValue = "true" ) 81 | boolean overWrite; 82 | 83 | /** 84 | * Ignore File Not Found errors during incremental build 85 | * 86 | * @since 1.0 87 | */ 88 | @Parameter( property = "copy.ignoreFileNotFoundOnIncremental", defaultValue = "true" ) 89 | boolean ignoreFileNotFoundOnIncremental; 90 | 91 | 92 | /** 93 | * @since 1.0 94 | */ 95 | @Component 96 | private MavenProject project; 97 | 98 | @Component 99 | private BuildContext buildContext; 100 | 101 | public void execute() throws MojoExecutionException 102 | { 103 | getLog().debug("Executing the copy-rename-maven-plugin"); 104 | if(fileSets!= null && fileSets.size() > 0){ 105 | for(FileSet fileSet: fileSets){ 106 | File srcFile = fileSet.getSourceFile(); 107 | File destFile = fileSet.getDestinationFile(); 108 | if(srcFile!=null){ 109 | copy(srcFile,destFile); 110 | } 111 | } 112 | } else if(sourceFile!= null){ 113 | copy(sourceFile,destinationFile); 114 | } else{ 115 | getLog().info("No Files to process"); 116 | } 117 | } 118 | 119 | private void copy(File srcFile,File destFile) throws MojoExecutionException{ 120 | 121 | if(!srcFile.exists()){ 122 | if(ignoreFileNotFoundOnIncremental && buildContext.isIncremental()){ 123 | getLog().warn("sourceFile "+srcFile.getAbsolutePath()+ " not found during incremental build"); 124 | } else { 125 | getLog().error("sourceFile "+srcFile.getAbsolutePath()+ " does not exist"); 126 | } 127 | } else if(srcFile.isDirectory()){ 128 | getLog().error("sourceFile "+srcFile.getAbsolutePath()+ " is not a file"); 129 | } else if(destFile == null){ 130 | getLog().error("destinationFile not specified"); 131 | } else if(destFile.exists() && destFile.isFile() && !overWrite){ 132 | getLog().error(destFile.getAbsolutePath()+" already exists and overWrite not set"); 133 | } else{ 134 | try { 135 | if(buildContext.isIncremental() && destFile.exists() && !buildContext.hasDelta(srcFile) && FileUtils.contentEquals(srcFile, destFile)){ 136 | getLog().info("No changes detected in "+srcFile.getAbsolutePath()); 137 | return; 138 | } 139 | FileUtils.copyFile(srcFile, destFile); 140 | getLog().info("Copied "+ srcFile.getAbsolutePath()+ " to "+ destFile.getAbsolutePath()); 141 | buildContext.refresh(destFile); 142 | } catch (IOException e) { 143 | throw new MojoExecutionException("could not copy "+srcFile.getAbsolutePath()+" to "+destFile.getAbsolutePath()); 144 | } 145 | } 146 | 147 | 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /src/main/java/com/coderplus/plugins/FileSet.java: -------------------------------------------------------------------------------- 1 | package com.coderplus.plugins; 2 | /* 3 | * The MIT License 4 | * 5 | * Copyright (c) 2004 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is furnished to do 12 | * so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | import java.io.File; 26 | 27 | public class FileSet { 28 | 29 | private File sourceFile; 30 | private File destinationFile; 31 | 32 | public File getSourceFile() { 33 | return sourceFile; 34 | } 35 | public void setSourceFile(File sourceFile) { 36 | this.sourceFile = sourceFile; 37 | } 38 | public File getDestinationFile() { 39 | return destinationFile; 40 | } 41 | public void setDestinationFile(File destinationFile) { 42 | this.destinationFile = destinationFile; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/coderplus/plugins/RenameMojo.java: -------------------------------------------------------------------------------- 1 | package com.coderplus.plugins; 2 | 3 | /* 4 | * The MIT License 5 | * 6 | * Copyright (c) 2004 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | 27 | import org.apache.maven.plugin.AbstractMojo; 28 | import org.apache.maven.plugin.MojoExecutionException; 29 | import org.apache.maven.plugins.annotations.Component; 30 | import org.apache.maven.plugins.annotations.LifecyclePhase; 31 | import org.apache.maven.plugins.annotations.Mojo; 32 | import org.apache.maven.plugins.annotations.Parameter; 33 | import org.apache.maven.project.MavenProject; 34 | import org.codehaus.plexus.util.FileUtils; 35 | import org.sonatype.plexus.build.incremental.BuildContext; 36 | 37 | import java.io.File; 38 | import java.io.IOException; 39 | import java.util.List; 40 | 41 | 42 | /** 43 | * Rename files or directories during build. 44 | * 45 | * @author Aneesh Joseph 46 | * @since 1.0 47 | */ 48 | @Mojo( name = "rename", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true ) 49 | public class RenameMojo 50 | extends AbstractMojo 51 | { 52 | /** 53 | * The file/directory which has to be renamed 54 | * 55 | * @since 1.0 56 | */ 57 | @Parameter( required = false ) 58 | private File sourceFile; 59 | /** 60 | * The target file/directory name 61 | * 62 | * @since 1.0 63 | */ 64 | @Parameter( required = false ) 65 | private File destinationFile; 66 | 67 | /** 68 | * Collection of FileSets to work on (FileSet contains sourceFile and destinationFile). See Usage for details. 69 | * 70 | * @since 1.0 71 | */ 72 | @Parameter( required = false ) 73 | private List fileSets; 74 | 75 | /** 76 | * Ignore File Not Found errors during incremental build 77 | * 78 | * @since 1.0 79 | */ 80 | @Parameter( property = "copy.overWrite", defaultValue = "true" ) 81 | boolean overWrite; 82 | 83 | /** 84 | * Ignore errors if the source file/directory was not found during incremental build 85 | * 86 | * @since 1.0 87 | */ 88 | @Parameter( property = "copy.ignoreFileNotFoundOnIncremental", defaultValue = "true" ) 89 | boolean ignoreFileNotFoundOnIncremental; 90 | 91 | 92 | /** 93 | * @since 1.0 94 | */ 95 | @Component 96 | private MavenProject project; 97 | 98 | @Component 99 | private BuildContext buildContext; 100 | 101 | public void execute() throws MojoExecutionException 102 | { 103 | getLog().debug("Executing the copy-rename-maven-plugin"); 104 | if(fileSets!= null && fileSets.size() > 0){ 105 | for(FileSet fileSet: fileSets){ 106 | File srcFile = fileSet.getSourceFile(); 107 | File destFile = fileSet.getDestinationFile(); 108 | if(srcFile!=null){ 109 | copy(srcFile,destFile); 110 | } 111 | } 112 | } else if(sourceFile!= null){ 113 | copy(sourceFile,destinationFile); 114 | } else{ 115 | getLog().info("No Files to process"); 116 | } 117 | } 118 | 119 | private void copy(File srcFile,File destFile) throws MojoExecutionException{ 120 | 121 | if(!srcFile.exists()){ 122 | if(ignoreFileNotFoundOnIncremental && buildContext.isIncremental()){ 123 | getLog().warn("sourceFile "+srcFile.getAbsolutePath()+ " not found during incremental build"); 124 | } else { 125 | getLog().error("sourceFile "+srcFile.getAbsolutePath()+ " does not exist"); 126 | } 127 | } else if(destFile == null){ 128 | getLog().error("destinationFile not specified"); 129 | } else if(destFile.exists() && (destFile.isFile() == srcFile.isFile()) && !overWrite){ 130 | getLog().error(destFile.getAbsolutePath()+" already exists and overWrite not set"); 131 | } else{ 132 | try { 133 | FileUtils.rename(srcFile, destFile); 134 | getLog().info("Renamed "+ srcFile.getAbsolutePath()+ " to "+ destFile.getAbsolutePath()); 135 | buildContext.refresh(destFile); 136 | } catch (IOException e) { 137 | throw new MojoExecutionException("could not rename "+srcFile.getAbsolutePath()+" to "+destFile 138 | .getAbsolutePath(),e); 139 | } 140 | } 141 | 142 | 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | copy 8 | rename 9 | 10 | 11 | 12 | 13 | true 14 | true 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/site/apt/index.apt: -------------------------------------------------------------------------------- 1 | ------ 2 | Introduction 3 | ------ 4 | Aneesh Joseph 5 | ------ 6 | 2014-10-25 7 | ------ 8 | 9 | ~~ The MIT License 10 | ~~ 11 | ~~ Copyright (c) 2004 12 | ~~ 13 | ~~ Permission is hereby granted, free of charge, to any person obtaining a copy of 14 | ~~ this software and associated documentation files (the "Software"), to deal in 15 | ~~ the Software without restriction, including without limitation the rights to 16 | ~~ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 17 | ~~ of the Software, and to permit persons to whom the Software is furnished to do 18 | ~~ so, subject to the following conditions: 19 | ~~ 20 | ~~ The above copyright notice and this permission notice shall be included in all 21 | ~~ copies or substantial portions of the Software. 22 | ~~ 23 | ~~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | ~~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | ~~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | ~~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | ~~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | ~~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | ~~ SOFTWARE. 30 | 31 | 32 | Copy Rename Maven Plugin 33 | 34 | ~~ Plugin introduction, description, and other relevant information. 35 | 36 | * The copy-rename-maven-plugin helps in copying files or renaming files or directories during the Maven build lifecycle. 37 | 38 | * This plugin is compatible with Eclipse m2e and should work on both full and incremental builds 39 | 40 | * Goals Overview 41 | 42 | ~~ General Information about the goals. 43 | 44 | * {{{./copy-mojo.html}copy-rename:copy}} Copy files during maven build. 45 | 46 | * {{{./rename-mojo.html}copy-rename:rename}} Rename files or directories during maven build. 47 | 48 | 49 | * Usage 50 | 51 | Instructions on how to use the Copy Rename Maven Plugin can be found on the {{{./usage.html}usage page}}. 52 | 53 | * Help/Contact 54 | 55 | In case you would like report an issue, head over to the {{{https://github.com/coderplus/copy-rename-maven-plugin}GitHub Page}}. If you would like to say hello, contact us at the {{{http://coderplus.com}CoderPlus website}}. 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/site/apt/usage.apt.vm: -------------------------------------------------------------------------------- 1 | ------ 2 | Usage 3 | ------ 4 | Aneesh Joseph 5 | ------ 6 | 2014-10-25 7 | ------ 8 | 9 | ~~ The MIT License 10 | ~~ 11 | ~~ Copyright (c) 2004 12 | ~~ 13 | ~~ Permission is hereby granted, free of charge, to any person obtaining a copy of 14 | ~~ this software and associated documentation files (the "Software"), to deal in 15 | ~~ the Software without restriction, including without limitation the rights to 16 | ~~ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 17 | ~~ of the Software, and to permit persons to whom the Software is furnished to do 18 | ~~ so, subject to the following conditions: 19 | ~~ 20 | ~~ The above copyright notice and this permission notice shall be included in all 21 | ~~ copies or substantial portions of the Software. 22 | ~~ 23 | ~~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | ~~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | ~~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | ~~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | ~~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | ~~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | ~~ SOFTWARE. 30 | 31 | 32 | Usage 33 | 34 | Brief examples on how to use the Copy Maven Plugin's goals. 35 | 36 | * Copy a single file during maven build 37 | 38 | Use this example to copy a file during maven build. 39 | 40 | ------------------- 41 | 42 | ... 43 | 44 | 45 | 46 | com.coderplus.maven.plugins 47 | copy-rename-maven-plugin 48 | ${project.version} 49 | 50 | 51 | copy-file 52 | generate-sources 53 | 54 | copy 55 | 56 | 57 | src/someDirectory/test.environment.properties 58 | target/someDir/environment.properties 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | ------------------- 67 | 68 | * Copy multiple files during a maven build 69 | 70 | The same as the previous example, but this time it will copy a directory instead of a file 71 | 72 | ------------------- 73 | 74 | ... 75 | 76 | ... 77 | 78 | 79 | 80 | com.coderplus.maven.plugins 81 | copy-rename-maven-plugin 82 | ${project.version} 83 | 84 | 85 | copy 86 | generate-sources 87 | 88 | copy 89 | 90 | 91 | 92 | 93 | src/someDirectory/test.environment.properties 94 | target/someDir/environment.properties 95 | 96 | 97 | src/someDirectory/test.logback.xml 98 | target/someDir/logback.xml 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | ------------------- 109 | * Rename a file during maven build 110 | 111 | The same as the first example, but this time it will do a rename instead of copy 112 | 113 | ------------------- 114 | 115 | ... 116 | 117 | 118 | 119 | com.coderplus.maven.plugins 120 | copy-rename-maven-plugin 121 | ${project.version} 122 | 123 | 124 | rename-file 125 | generate-sources 126 | 127 | rename 128 | 129 | 130 | src/someDirectory/test.environment.properties 131 | target/someDir/environment.properties 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | ------------------- 140 | * Rename a directory during maven build 141 | 142 | Similar to the above example, but this time it will do a rename a directory 143 | 144 | ------------------- 145 | 146 | ... 147 | 148 | 149 | 150 | com.coderplus.maven.plugins 151 | copy-rename-maven-plugin 152 | ${project.version} 153 | 154 | 155 | rename-file 156 | generate-sources 157 | 158 | rename 159 | 160 | 161 | target/someDirectory/ 162 | target/someOtherDirectory/ 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | ------------------- 171 | * Rename multiple files during maven build 172 | 173 | The same as the second example, but this time it will do a rename instead of copy 174 | 175 | ------------------- 176 | 177 | ... 178 | 179 | 180 | 181 | com.coderplus.maven.plugins 182 | copy-rename-maven-plugin 183 | ${project.version} 184 | 185 | 186 | rename-file 187 | generate-sources 188 | 189 | rename 190 | 191 | 192 | 193 | 194 | src/someDirectory/test.environment.properties 195 | target/someDir/environment.properties 196 | 197 | 198 | src/someDirectory/test.logback.xml 199 | target/someDir/logback.xml 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | ------------------- 210 | 211 | * Rename multiple files/directories during maven build 212 | 213 | The same as the second example, but this time it will do a rename instead of copy 214 | 215 | ------------------- 216 | 217 | ... 218 | 219 | 220 | 221 | com.coderplus.maven.plugins 222 | copy-rename-maven-plugin 223 | ${project.version} 224 | 225 | 226 | rename-file 227 | generate-sources 228 | 229 | rename 230 | 231 | 232 | 233 | 234 | src/someDirectory/test.environment.properties 235 | target/someDir/environment.properties 236 | 237 | 238 | src/someFolder/ 239 | target/someOtherFolder/ 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | ------------------- -------------------------------------------------------------------------------- /src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 14 | 15 | 16 | org.apache.maven.skins 17 | maven-fluido-skin 18 | 1.3.1 19 | 20 | 21 | 22 | Copy Rename Maven Plugin 23 | https://coderplus.github.io/copy-rename-maven-plugin/ 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | --------------------------------------------------------------------------------