I'm trying to integrate PartCover.NET with NAnt and CruiseControl.NET
I can run PartCover.NET browser without problems, but it does not work once I try to run it in an NAnt task (in my CCNET build).
There must be an issue with my NAnt target but I can't find it. Maybe someone had experienced the same issues in the past?.
<target name="CoverageUnitTest" description="Code coverage of unit tests">
<exec program="${PartCover.exe}">
<arg value="--target=${NUnit.console}" />
<arg value="--target-work-dir=${project.dir}\bin\${configuration}"/>
<arg value="--target-args=${project}.dll" />
<arg value="--output=C:\partcover.xml" />
<arg value="--include=[*]*" />
</exec>
</target>
In CruiseControl, I got the following error message:
[exec] Invalid option '--target C:\NUnit\bin\nunit-console.exe'
Build Error: NAnt.Core.BuildException
External Program Failed: C:\PartCover\PartCover.exe (return code was -1)
in C:\default.build line: 20 col: 4
at NAnt.Core.Tasks.ExternalProgramBase.ExecuteTask()
at NAnt.Core.Tasks.ExecTask.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Target.Execute()
at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
at NAnt.Core.Project.Execute()
at NAnt.Core.Project.Run()
thanks !
David
As You may have noticed this task is rather complicated. It drove me to the edge of insanity but at last I got it running.
Here is some general advice:
use PartCover version 2.2 instead of 2.3 since the latter is a dev version that seems to be unstable.
remember to register PartCover.CorDriver.dll.
passing arguments is the hardest part if You need to quote paths. I finally decided to use a configuration file and pass it via --settings.
Replace = with space and use the " ; marker around the parameters for the arguments
Related
The text is the same as the title.
I tried various methods on google to solve this error. But it doesn't work, so I need your help.
Anyone is welcome, please help me to solve this error.
awesometech#awesometech:~/catkin_ws$ roslaunch urs_wearable world.launch
... logging to /home/awesometech/.ros/log/165b93fc-9d30-11ed-967c-a99cf3fa13f4/roslaunch-awesometech-4851.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
RLException: while processing /home/awesometech/catkin_ws/src/URSSimEnvironments/urs_wearable/launch/world.launch:
while processing /home/awesometech/catkin_ws/src/URSSimEnvironments/urs_wearable/launch/world.launch:
..
Invalid tag: maximum recursion depth exceeded while calling a Python object.
Arg xml is
The traceback for the exception was written to the log file
this is my code I think there is no error in this code.
<?xml version="1.0"?>
<launch>
<include file="$(find urs_wearable)/launch/world.launch">
<arg name="world" value="$(find urs_wearable)/worlds/test.world" />
<arg name="reference_latitude" value="32.319939" />
<arg name="reference_longitude" value="-106.763657" />
</include>
</launch>
It appears you’re launch file includes itself. This creates a circular dependency as it will never stop trying to include itself. Remove the following line:
<include file="$(find urs_wearable)/launch/world.launch">
So,
I keep having this error:
Severity Code Description Line Suppression State
Error MSB4184 The expression "[System.Version]::Parse('')" cannot be evaluated. Version string portion was too short or too long. ...\.nuget\packages\gitinfo\2.2.0\build\GitInfo.targets 218
whenever I build/rebuild my solution. After trying to build it several times it runs perfectly but it takes a lot building the solution, so I take like 3 to 5 times more time to build and test my changes.
Here is the error-related code:
<Target Name="_EnsureGit">
<Exec Command='$(GitExe) --version'
EchoOff='true'
ContinueOnError='true'
ConsoleToMSBuild='true'
StandardErrorImportance='high'
StandardOutputImportance='low'>
<Output TaskParameter="ConsoleOutput" PropertyName="_GitOutput"/>
<Output TaskParameter="ExitCode" PropertyName="MSBuildLastExitCode" />
</Exec>
<Error Condition="'$(MSBuildLastExitCode)' != '0'" Text="Failed to run `git --version`. Git may not be properly installed: %0A $(_GitOutput)" />
<PropertyGroup>
<_GitCurrentVersion>$([System.Text.RegularExpressions.Regex]::Match("$(_GitOutput)", "\d+\.\d+\.\d+").Value)</_GitCurrentVersion>
</PropertyGroup>
<Error Condition="$([System.Version]::Parse('$(_GitCurrentVersion)').CompareTo($([System.Version]::Parse('$(GitMinVersion)')))) < 0"
Text="Required minimum git version is $(GitMinVersion) but found $(_GitCurrentVersion)." />
</Target>
As I said, the error disappears after some tries to build but it's really annoying and time consuming. I reinstalled VS2022, recloned my repo, reinstalled git, deleted the ".nuget" folder but the problem still occurs.
What should I do?
I am using Spring official docs to understand the Spring Basic Application and Environment set up on Linux using Ant.
Softwares and system configurations:
OS: Linux/Ubuntu
JRE: 1.8.0_51-b16
Ant Version: 1.9.3
IDE: Luna Service Release 1 (4.4.1)
Project directory structure:
Everything goes fine till end of Section 1.3 where I can start the tomcat server and execute ant, ant deploy successfully and I have the desired output as follows:
But when I am trying to execute ant list - the build fails.
Buildfile: /home/sandeep/MyDocs/workspace/springapp/build.xml
list:
BUILD FAILED
/home/sandeep/MyDocs/workspace/springapp/build.xml:113: Problem: failed to create task or type list
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any / declarations have taken place.
Here is the list target in my build.xml:
<target name="list" description="List Tomcat applications">
<list url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"/>
</target>
What am I doing wrong here? Here is a link to my entire build.xml.
In the article you linked to, it shows how to add the <list> task:
<taskdef name="list" classname="org.apache.catalina.ant.ListTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
Add the above line to your build.xml.
I think task list is unknown to ant. There is no task named list defined by ant. To start tomcat I did something like --
<exec executable="${tomcat.home}/bin/tomcat5.exe" >
<arg value="start"/>
<env key="JAVA_OPTS"
value="-Xint -Xdebug -Xrunjdwp:transport=dt_socket,address=${hotswap.port},server=y,suspend=n"/>
</exec>
</target>
I have Cruise Control configured with a task to run a NAnt script, which runs an MSTest suite. MSTest allows me to specify test categories so I want to specify "!Integration" (which means "don't run Integration tests"). My Nant script successfully runs when I run it from the command line, but when Cruise runs it, the "!Integration" directive is being garbled -- the Cruise output suggests its inserting a line break after the '!' character. The result is that all my tests run, including integration tests.
Extract from ccnet.config:
<tasks>
<nant>
<executable>C:\nant\bin\nant.exe</executable>
<baseDirectory>C:\MyProject\BuildDirectory</baseDirectory>
<buildFile>MyProject.build</buildFile>
<targetList>
<target>CIServerBuild</target>
</targetList>
</nant>
</tasks>
Extract from MyProject.build:
<target name="CIServerBuild">
:
<call target="RunUnitTests" />
</target>
<target name="RunUnitTests">
<property name="TestCategories" value="!Integration" />
<call target="RunMSTest" failonerror="true"/>
</target>
<target name="RunMSTest">
<call target="BuildListOfTestContainers" failonerror="true"/>
<exec program="${MSTest.exe}"
commandline=" /category:"${TestCategories}" ${TestContainers} /resultsfile:${MSTest.ResultsFile} /nologo "
/>
</target>
Extract from Cruise output:
[exec] Starting 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe ( /category:"!
Integration" /testcontainer:C:\TaxWise\BuildDirectory\TaxWise\TaxWise.Data.Tests\bin\Debug\TaxWise.Data.Tests.dll /testcontainer:C:\TaxWise\BuildDirectory\TaxWise\TaxWise.Domain.Tests\bin\Debug\TaxWise.Domain.Tests.dll /testcontainer:C:\TaxWise\BuildDirectory\TaxWise\TaxWise.Infrastructure.Tests\bin\Debug\TaxWise.Infrastructure.Tests.dll /resultsfile:.\TestResults\UnitTests.trx /nologo )'
in 'C:\TaxWise\BuildDirectory'
I have tried replacing the '!' character with
'!'
but that made no difference.
Any ideas, anyone?
I suggest splitting the commandline attribute in the exec task into Nant arg elements.
http://nant.sourceforge.net/release/0.85/help/tasks/exec.html
You'll have more flexibility and the readability will increase.
Yes, perhaps it is not caused by CC. Try setting verbose="True" on the <exec> task and check the raw build protocol. Remember what you see on the report page is not the exact output (typically subject to line-wrap and coalescing whitespaces).
Maybe it depends on from where you run the script, a hidden dependency on a build property or different environment variables. You can check the latter using <exec program="cmd.exe" commandline="/c set" />. For the properties you can use the following script:
<script language="C#" prefix="util" verbose="true">
<code>
<![CDATA[
public static void ScriptMain(Project project)
{
foreach (DictionaryEntry entry in new System.Collections.SortedList(project.Properties) )
Console.WriteLine("{0}={1}", entry.Key, entry.Value);
}
]]>
</code>
</script>
I am trying to copy a folder to a remote machine using xcopy. This command is executed via cruise control task. I can run xcopy source destOnRemoteMachine successfully if i am running it from command prompt. But if i am executing it from cruise control .net, it is always complaining about "Invalid drive specification" error.
I tried :
> <exec
> executable="c:\Windows\System32\xcopy.exe">
> <baseDirectory>$(BASE)\Project</baseDirectory>
> <buildArgs>.\*.* RemoteMachine\Project /Y</buildArgs>
> <buildTimeoutSeconds>10</buildTimeoutSeconds>
> <successExitCodes>-1,0,1</successExitCodes>
> </exec>
and :
<exec executable="c:\Windows\System32\cmd.exe">
<baseDirectory>$(BASE)\Project</baseDirectory>
<buildArgs>/C xcopy $(BASE)\Project\*.* RemoteMachine /y</buildArgs>
<buildTimeoutSeconds>30</buildTimeoutSeconds>
<successExitCodes>-1,0,1</successExitCodes>
</exec>
Any Suggestions?
thanks for your answer. Putting xcopy in batch was also not helpful, the problem was something else. here is problem:
It was problem with the account on which Cruise Control .net service was running. It was running as local service. Thus was not able to see the network path. I changed CCNet Service to run on a domain account which have permission to read/ write on remote machine. This solved my problem.
Thanks.
Create a batch file using xcopy source destOnRemoteMachine command and execute that bat file using <exec> command in cruise control .net
In my case I was running CC as a user account, after having used NET USE to persistently map a drive letter to a network share on another domain. Although it worked in a desktop session, CC could still not get to the share as part of the build. Executing NET USE as part of the build (without a drive mapping) allowed the copy to succeed.
<exec program="net" verbose="true">
<arg value="use" />
<arg value="\\server\share" />
<arg value="password" />
<arg value="/user:domain\username" />
</exec>