nant tasks to copy zip folder from one machine to other - nant

How do i copy a zip folder from my local machine to a server on same domain using nant script

Use the nant copy task.
<copy
file="myfile.zip"
tofile="\\servername\folder\myfile.zip"
inputencoding="latin1"
outputencoding="utf-8" />

Related

Create webdeploy package from regular .zip file

Currently, as a part of our build-process, we organize the target wwwroot folder structure and build a .zip of it. This is our deployment artifact.
The structure of the .zip file is:
/App_Browsers
/App_Config
/App_data
/App_Start
/bin
/data
/dist
/layouts
/views
default.aspx
web.config
Is it possible to convert this regular .zip file to a file that can be deployed using webdeploy/msdeploy? Or can webdeploy/msdeploy also deploy regular .zip files?
Is it possible to convert this regular .zip file to a file that can be deployed using webdeploy/msdeploy? Or can webdeploy/msdeploy also deploy regular .zip files?
The answer is yes.
AFAIK, msdeploy does not support packages, which were zipped using other than built in windows zip archiver.
So, to resolve this issue, you could unzip this regular .zip file, and zipped with built in windows zip archiver, like, the task Archive Files task or 7z.exe.
You could check this thread for some more details.
Hope this helps.

Netbeans, how to build project deploy(war) file into custom folder?

Netbeans project, is it possible to build deploy(.war) file into domain's autodeploy folder automatically, not in dist folder?
So that, it would be VERY useful to deploy project .war file to local glassfish server automatically.
You can automate almost all kinds of things, from compilation files processed by ant stages.
In project.properties file must add a reference for your end folder
war.custom.dir=/path/to/end/folder/
"this is not mandatory but is a correct method"
Then, in your build.xml file should add this chunk of code
<target name="-post-dist">
<echo message="Copy .war file to my custom folder"/>
<copy file="${dist.war}" todir="${war.custom.dir}" />
</target>
And your file .war, will move wherever you want.
Could also be changed your file in the build-impl.xml target "do-ear-dist"
allowing directly effect the compression to your end folder.
Or you could also modify references in your project to work on your end folder, the mechanism is really very simple to customize as you think best.

How to create MSBuild targets file to deploy files?

Given I have a post build process that generates files in \bin\out how can I use a MSBuild targets file to state that all files (recursively) in that directory should be published during web deploy?
Let's split this in two parts:
First, build the web project:
<Target Name="BuildWeb">
<MSBuild Projects="WebExtranet\WebExtranet.csproj"
Properties="Configuration=$(Environment);DeployOnBuild=True;CreatePackageOnPublish=True;BaseIntermediateOutputPath=..\$(DistDir)\Web\" />
</Target>
Then use this to publish to the local IIS (you might need to adjust the msdeploy command to suit your needs)
<Target Name="DeployWeb">
<ItemGroup>
<PackageSourceDir Include='$(DistDir)\Web\$(Environment)\Package\WebExtranet.zip' />
</ItemGroup>
<Message Text="Package path: %(PackageSourceDir.FullPath)" />
<Exec Command=""c:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -allowUntrusted -source:package="%(PackageSourceDir.FullPath)" -setParam:'IIS Web Application Name'='My Web App' -dest:auto"/>
</Target>
Common pitfalls:
The msbuild version is important. I'm using V3.
You have to have the web application already created on IIS. Only need to do it once.
Note that the $(Environment) variable is the build configuration. I have several, but run the first target and check the folder structure created. Then adjust the script.

Modification of NetBeans Ant build script

I have an project in NetBeans. I made some preparations to make database migration easier, and I put all things related to migration in one folder in root of my project.
Now I want to make this whole directory included in the distribution jar or war.
I deducted that i have to modify the ="-pre-dist" target, but I not very familiar with and and I'm lost in all of these netbeans options, paramaters predefined in build script.
Assuming my migration data is in folder "migration", how should ant command look to include this folder in distrubution archive?
I understood from your question that you want to achieve the following:
You have a directory migration with some contents in the root of the project
You want this directory to be included in the JAR file created as a result of clean and build command in NetBeans IDE
To achieve this add the following ANT target in your build.xml file:
<target name="-pre-jar">
<mkdir dir="${build.classes.dir}/migration"/>
<copy todir="${build.classes.dir}/migration">
<fileset dir="${basedir}/migration"/>
</copy>
</target>
Now when you run the command clean and build the resulting JAR file will contain the folder migration with all the contents. Note: this target is not "-pre-dist" but is "-pre-jar"

netbeans - scp after build

I'd like to copy a file to a remote server with scp after building, using Netbeans.
What I do now manually is:
Clean and Build Main Project
scp dist/project.jar login#dest/...../......
Is there some way to automate this task? I tried looking at the build.xml file, but it really looks like something I don't want to mess with.
Thanks
Nicola
I use WinSCP to perform something similar to this. I monitor a local directory for file changes and it automatically transfers the changes files.
This is possible, see the scp task on ant's site: http://ant.apache.org/manual/Tasks/scp.html
An example from the site:
Copy a set of files to a directory
<scp todir="user:password#somehost:/home/chuck">
<fileset dir="src_dir">
<include name="**/*.java"/>
</fileset>
</scp>
<scp todir="user:password#somehost:/home/chuck">
<fileset dir="src_dir" excludes="**/*.java"/>
</scp>
You can hardcore the password inside the build task, but that's not a great idea. Better to use public keys.