Windows 7 Professional (64 bit), Java 1.8.
I build my project by Ant.
To create folder I use this:
<mkdir dir="${var.data.dir.name}" />
OK. The folder is created, but it read-only. But I need to create writable folder. How I can do this?
Use the setpermissions task to fix up the ACL after you create it.
Related
I have a project where I need to download a set of zip files from our nexus and unpack them.
I have the dependency and settings file set up and working but how do I get the files to my local directory so they can be unpacked?
/J
Found a way:
Create a copy task like:
<copy toDir="./dependencies/">
<fileset refId="local_build_deps" />
</copy>
Only problem it copies more than I want but at least I get the files I need.
Anyone with a better solution is welcome to respond.
/J
I'm trying to transfer some files in a tmp dir then rename tmp dir to 'live' dir. It seems ANT FTP does not support directory rename. Any suggestion, work around?
Interesting problem. I did not realise how restricted the ANT ftp task was, only a limited range of ftp operations are supported.
The best work-around I can offer is to use an embedded groovy script as follows:
<target name="ftp">
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"/>
<groovy>
import org.apache.commons.net.ftp.FTPClient
new FTPClient().with {
connect "192.168.33.10"
login "mark", "letmein"
rename "testdir2", "testdir3"
disconnect()
}
</groovy>
</target>
Notes:
I tested this example with vsftpd. Had to enable server-side user and write operations before everything worked.
I've been reading elsewhere that some FTP servers do not support renaming directories.
Kindly suggest how to build exploded jars using Ant task?
Thanks.
An exploded jar is simply a directory which has the same structure as a jar file. Just use copy, for example, to put all the files you want in this directory.
I have a log4j.properties that sit right under the src folder. When I building my war file using ANT tool, the particular properties file wasn't pack inside WEB-INF/classes folder, and it was right under the "root" directory of the war file (if you unwar it). I heard from my colleague mention that this is not correct. May I know is this true? If no, how should I correct it?
THanks #!
Yes, log4j.properties (or any other resource loaded from the classpath) should be at the root of your Java source folder (src/main/java, build/main, src, JavaSource, or however you have your project configured).
In the WAR, it should be under WEB-INF/classes, not at the root (as if you unzipped it).
If this is not the case, being able to see your ANT build file would be very helpful. You should have something like this line configured within your war task:
<classes dir="build/main"/>
As long as you have a build/main/log4j.properties in your Ant basedir, this should work as you're expecting.
I'm new to using TFS build. I've got a build defined that runs as a continuous integration. It creates a drop folder, but there's nothing in it.
What's the best practice for moving stuff in the drop folder? I've seen a Binaries folder, do I need to copy things into there, or do I alter the TFSbuild.proj in some way to copy the files I want to the drop folder?
It sounds like you want to copy miscellaneous files from your workspace (or elsewhere) into the drop location?
The target above gives you an example of how to create a target to copy files, but you're probably wondering how to hook it up in your TFSBuild.proj.
A simple way to do this is using one of the pre-defined skeleton targets for this such as AfterDropBuild. If you had a target like the one mentioned above for copying your files you would put this in TFSBuild.proj:
<CreateItem Include="$(SolutionRoot)\Source\RandomFilesInWorkspaceFolder\**\*.*">
<Output TaskParameter="Include" ItemName="RandomFiles" />
</CreateItem>
<Copy SourceFiles="#(RandomFiles)" DestinationFiles="#(RandomFiles->'$(DropLocation)\RandomDestinationSubFolder\%(RecursiveDir)%(Filename)%(Extension)')" />
I seemed to get it working by adding this near the end of my TFSBuild.proj
<Target Name="PackageBinaries">
<ItemGroup>
<FilesToDrop Include="$(SolutionRoot)\MyProduct\Installer\Bin\**\*.msi"/>
</ItemGroup>
<Message Text="FilesToDrop=#(FilesToDrop)"/>
<Copy SourceFiles="#(FilesToDrop)"
DestinationFiles="#(FilesToDrop ->'$(BinariesRoot)\%(RecursiveDir)%(Filename)%(Extension)')"/>
</Target>
It copies wanted msi files into the Binaries folder which the normal tfs build system then copies to the drop location. I noticed the Binaries folder gets deleted everytime a build is started, so you don’t have to worry about cleaning up.
The PackageBinaries target seems to be the standard target name that you can override for doing this kind of thing.
Update Newer versions of TFS probably have better ways!