Re: site with file copy
On 03-05-18 08:03, Philipp Kraus wrote: Hello, I’m using „mvn site“ command to build for my project the project website as HTML code, During the site goal is running I need to copy some files into the target/site directory, how can I do this? I need to copy some single files to the output director, but only on the site goal. You could use the anrun plugin during the (pre-)site phase or stick the files into src/site/resources/ (with optional directories) so the site plugin picks them up. -Mark - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
site with file copy
Hello, I’m using „mvn site“ command to build for my project the project website as HTML code, During the site goal is running I need to copy some files into the target/site directory, how can I do this? I need to copy some single files to the output director, but only on the site goal. Thanks Phil
Maven build resource file copy failed.
Hi guys, I come from China. I got an problem "Failed to copy full contents from..." while using maven to build my project. Because there is an *.xlsx file in the resources folder. This excel file contains some Chinese characters. I have tried with add the following configuration in my pom.xls as below. But it doesn't work. org.apache.maven.plugins maven-resources-plugin 3.0.2 xls xlsx I used "mvn -X clean compile" to build the porject and found the exception was thrown in the line of following class. org.apache.maven.shared.utils.io.FileUtils.copyFile(FileUtils.java:839) FileUitl.copyFile(..) source code is : private static void doCopyFile( @Nonnull File source, @Nonnull File destination ) throws IOException { FileInputStream fis = null; FileOutputStream fos = null; FileChannel input = null; FileChannel output = null; try { fis = new FileInputStream( source ); fos = new FileOutputStream( destination ); input = fis.getChannel(); output = fos.getChannel(); long size = input.size(); long pos = 0; long count; while ( pos < size ) { count = size - pos > FILE_COPY_BUFFER_SIZE ? FILE_COPY_BUFFER_SIZE : size - pos; pos += output.transferFrom( input, pos, count ); } } finally { IOUtil.close( output ); IOUtil.close( fos ); IOUtil.close( input ); IOUtil.close( fis ); } } I tried with junit to call it directory and got the same result. @Test public void testFileCopy() throws IOException { String path = "E:\\test"; String srcFilePath = path + "/my.xlsx"; String destFilePath = path + "/my2.xlsx"; File srcFile = new File(srcFilePath); File destFile = new File(destFilePath); FileUtils.copyFile(srcFile, destFile); assertEquals(srcFile.length(), destFile.length()); } But it was passed junit test by using the file copy by my own. The source code is the following. /** * Copy a file to b file. * @param src * @param dest * @return True for successfully. False for failed or empty parameter. * @throws RrsException */ public static boolean copy(File src, File dest) throws RrsException{ if (src == null || dest == null){ return false; } try ( OutputStream os = new FileOutputStream(dest); ){ write(src, os); } catch (IOException e) { String msg = MessageFormat.format("Cannot copy file from [{0}] to [{1}]", src.getAbsolutePath(), dest.getAbsolutePath()); throw new RrsException(msg); } return true; } /** * Write a file with BufferedOutputStream. * No close method called in this method for parameter 'os'. * The caller should be close it itself. * @param file * @param os * @throws RrsException */ public static void write(File file, OutputStream os) throws RrsException{ BufferedOutputStream bos = new BufferedOutputStream(os); try ( BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); ) { byte[] buffered = new byte[1024 * 256]; int len = 0; int count = 0; while((len = bis.read(buffered)) != -1){ bos.write(buffered, 0, len); if (++count % 10 == 0){ bos.flush(); } } bos.flush(); } catch (Exception e) { throw new RrsException(e.getMessage(), e); } } Could any one have a check that what different between these two way for copying file? What configuration can be added to my project to fix the problem? Thank you very much. -- THX & B.RGDS Ben
Windows 7 symlinks and maven file copy
Hi We have just updated to Windows 7 and for some resource files in one of our projects we are using Windows 7 symlinks. The problem is that the maven-resource-plugin uses some org.codehaus.plexus.util.FileUtils class from Plexus which does a sanity check after the file is copied to the target folder. It checks if the file length are the same which on Windows 7 is not true. It seems that java.io.File.lenght() returns 0 for Windows 7 symlinks. (On Linux the length will be the length of the file that the link points to) I suppose I can filter all resource to avoid the sanity check but it does not seems right. Any suggestions on suitable workarounds? Thanks Lucas -- Lucas Persson | Principal Member of Technical Staff Phone: +4684773644 | | | Mobile: +46730946656 Oracle Communications Platform ORACLE Sweden | Folkungagatan 122 | 116 30 Stockholm Oracle Svenska AB, Kronborgsgrnd 17, S-164 28 KISTA, reg.no. 556254-6746 Oracle is committed to developing practices and products that help protect the environment
Remote file copy
I have a need to implement Maven style deploy functionality (copy files to multiple remote servers as defined in an xml file on the source machine). Attempts to find something using google have been unsuccessful, mostly due to the generality of the query. What other Apache projects might be best suited for this task? Thanks Robert Egan This email message and any attachments may contain confidential, proprietary or non-public information. The information is intended solely for the designated recipient(s). If an addressing or transmission error has misdirected this email, please notify the sender immediately and destroy this email. Any review, dissemination, use or reliance upon this information by unintended recipients is prohibited. Any opinions expressed in this email are those of the author personally.
Re: Remote file copy
On 09/04/2008, at 9:46 PM, [EMAIL PROTECTED] wrote: I have a need to implement Maven style deploy functionality (copy files to multiple remote servers as defined in an xml file on the source machine). Attempts to find something using google have been unsuccessful, mostly due to the generality of the query. What other Apache projects might be best suited for this task? http://docs.atlassian.com/maven-upload-plugin/1.1/usage.html Might do what you need. LD. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
File Copy
I want to copy a file from one directory to another. Is there any standard elegant way to copy a file in Maven.I could not find any.(Suggest me any if you know). Instead Iam using the ant plugin for maven trying to do the copy. I tried this... plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-antrun-plugin/artifactId configuration tasks copy file=C:\build\work\abc.ear tofile=C:\abc/ /tasks /configuration /plugin The above piece runs fine successfully.But,the file is NEVER copied. Any suggestions please...
Re: File Copy
On 5/19/06, Patil, Shivakumar (GE Healthcare) [EMAIL PROTECTED] wrote: I want to copy a file from one directory to another. Is there any standard elegant way to copy a file in Maven.I could not find any.(Suggest me any if you know). Instead Iam using the ant plugin for maven trying to do the copy. I tried this... plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-antrun-plugin/artifactId configuration tasks copy file=C:\build\work\abc.ear tofile=C:\abc/ /tasks /configuration /plugin The above piece runs fine successfully.But,the file is NEVER copied. Any suggestions please... Sounds like you are looking for resources. -- Jamie Bisotti
Re: File Copy
It's probably because you didn't define at what execution or phase the antrun plugin should do that task, see its docs or the m2 book. Jamie Bisotti wrote: On 5/19/06, Patil, Shivakumar (GE Healthcare) [EMAIL PROTECTED] wrote: I want to copy a file from one directory to another. Is there any standard elegant way to copy a file in Maven.I could not find any.(Suggest me any if you know). Instead Iam using the ant plugin for maven trying to do the copy. I tried this... plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-antrun-plugin/artifactId configuration tasks copy file=C:\build\work\abc.ear tofile=C:\abc/ /tasks /configuration /plugin The above piece runs fine successfully.But,the file is NEVER copied. Any suggestions please... Sounds like you are looking for resources. -- With kind regards, Geoffrey De Smet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]