Javadoc with Ant results in strange source code errors - ant

I try to generate Javadoc with Ant, but no files are generated. Source code errors like the text below is shown. These should not be shown, since there is nothing wrong with the source code. It can be compiled with both Eclipse and Ant without problems. How can I get Javadoc to work with Ant?
[javadoc] Loading source file C:\Users\eyvind\workspaceLuna\Group_1_Memory\Memory Group\src\memory\FileManager.java...
[javadoc] C:\Users\eyvind\workspaceLuna\Group_1_Memory\Memory Group\src\memory\FileManager.java:65: '{' expected
[javadoc] try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(path))){
[javadoc] ^
[javadoc] C:\Users\eyvind\workspaceLuna\Group_1_Memory\Memory Group\src\memory\FileManager.java:65: ')' expected
[javadoc] try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(path))){
[javadoc] ^
[javadoc] C:\Users\eyvind\workspaceLuna\Group_1_Memory\Memory Group\src\memory\FileManager.java:65: ';' expected
[javadoc] try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(path))){
[javadoc] ^

Related

Using anonymous records gives syntax error: FS0010: Unexpected symbol '|' in expression

I'm eager to use F# 4.6 anonymous records, but the compiler doesn't seem to "get it". How can I specify that I'm using 4.6? I've tried a lot of googling, but there's no documentation on how to actually tell the compiler to use the newest version(?).
Starting a new dotnet new console -lang F# -o src/App, and trying to make a dummy example:
open System
[<EntryPoint>]
let main argv =
let myrec = {| X=3; Y=4 |}
printfn "Hello World from F#! test %A" myrec
0 // return an integer exit code
Doesn't work because:
src/App/Program.fs(5,18): error FS0010: Unexpected symbol '|' in expression [src/App/App.fsproj]
src/App/Program.fs(5,17): error FS0604: Unmatched '{' [src/App/App.fsproj]
my App.fsproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
</Project>
Turns out it was my .NET Core Runtime that was too far behind. I didn't install the very most recent version because of the unstability warning for MacOS, but I now see that you need the MacOS-unstable version for it to support F# 4.6.
The solution was to just go to https://dotnet.microsoft.com/download/dotnet-core/2.2 and install the most recent version anyway!

Load Groovy script from file

I am trying to load a groovy script from file in a new template.
I tried to set the following under "Groovy template transformation":
${SCRIPT, template="cloud_services_jenkins_templates/Cisco Git Component Pom Based Version.template"}
Invalid Groovy template
groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
SimpleTemplateScript10.groovy: 2: unexpected token: SCRIPT # line 2, column 15.
send(out,"""${SCRIPT, template="cloud_services_jenkins_templates/Cisco Git Component Pom Based Version.template"} """);
^
1 error
at com.cloudbees.hudson.plugins.modeling.impl.SimpleTemplateEngine.parseScript(SimpleTemplateEngine.java:145)
at com.cloudbees.hudson.plugins.modeling.impl.SimpleTemplateEngine.createTemplate(SimpleTemplateEngine.java:131)
at com.cloudbees.hudson.plugins.modeling.impl.SimpleTemplateEngine.createTemplate(SimpleTemplateEngine.java:125)
at groovy.text.TemplateEngine.createTemplate(TemplateEngine.java:38)
any pointers on what is the issue?

Visual Studio opaque compilation error indication

I am trying to compile OpenCV with Cuda support using Microsoft Visual Studio 2013 and get the following compilation error message:
22> CMake Error at cuda_compile_generated_pyrlk.cu.obj.cmake:264 (message):
22> Error generating file
22> F:/Nir/dev/opencv/build/visualStudioA/modules/cudaoptflow/CMakeFiles/cuda_compile.dir/src/cuda/Debug/cuda_compile_generated_pyrlk.cu.obj
22>
22>
22>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(170,5): error MSB6006: "cmd.exe" exited with code 1.
Is there a way to get more information about the error?
Increasing log verbosity, or getting the nvcc command that failed could be useful
Cuda compile verbosity can be enabled at CMakeCache.txt file:
//Print out the commands run while compiling the CUDA source file.
// With the Makefile generator this defaults to VERBOSE variable
// specified on the command line, but can be forced on with this
// option.
CUDA_VERBOSE_BUILD:BOOL=ON

Javac producing error with no origin

I am using javac in ant to compile a project and I am getting an compilation error message without the file or line number. Why is this and how can i find where in the (large) project the problem is?
build.xml
make_folders:
compile:
[javac] Compiling 33 source files to *project root*/bin/classes
[javac] error: incompatible types: String cannot be converted to Integer
[javac] Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
[javac] 1 error
BUILD FAILED
*project root*/build.xml:33: Compile failed; see the compiler error output for details.
And heres the relevant lines with verbose set to true:
[javac] [loading ZipFileIndexFileObject[/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/ct.sym(META-INF/sym/rt.jar/java/util/Date.class)]]
[javac] error: incompatible types: String cannot be converted to Integer
UPDATE:
So I managed to figure out that the error it was originating from calling a function in a class from within an inner class in said outer class. I'm not sure why this produced an error or why it was presented with such little information so any help would still be appreciated.

How to use MsBuild MsDeployPublish to target local file system?

I'm trying to replicate the Visual Studio 2010 "Publish..." command (applicable to Web Application projects) where I would in the UI choose Publish Method: "File System".
My attempt at this is...
%msbuild% /t:MsDeployPublish /property:MsDeployServiceUrl="file:///d:\MyDeploymentFolder";MsDeployPublishMethod="File System" "d:\MySourceFolder\Project.csproj"
... and having tried a method of "FileSystem", "File System", "Local", and a few others.
The error I get implies that MsDeploy is still trying to push to an IIS server:
"D:\MySourceFolder\Project.csproj" (MsDeployPub
lish target) (1) ->
(MSDeployPublish target) ->
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web
.Publishing.targets(3847,5): error : Web deployment task failed.(The metabase k
ey '/lm/w3svc' could not be found.) [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : \r [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : The metabase key '/lm/w3svc' could not be fo
und.\r [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : Unable to access the IIS configuration syste
m. Please make sure you have IIS 7 (or later) installed.\r [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : Retrieving the COM class factory for compone
nt with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} failed due to the followin
g error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REG
DB_E_CLASSNOTREG)). [D:\MySourceFolder\Project.csproj]
How can I target the file system for deployment, as Visual Studio normally lets me in the GUI?
As per my answer from Using MSBuild, how do I build an MVC4 solution from the command line (applying Web.config transformations in the process) and output to a folder?
msbuild ProjectFile.csproj /p:Configuration=Release ^
/p:Platform=AnyCPU ^
/t:WebPublish ^
/p:WebPublishMethod=FileSystem ^
/p:DeleteExistingFiles=True ^
/p:publishUrl=c:\output
Or if you are building the solution file:
msbuild Solution.sln /p:Configuration=Release ^
/p:DeployOnBuild=True ^
/p:DeployDefaultTarget=WebPublish ^
/p:WebPublishMethod=FileSystem ^
/p:DeleteExistingFiles=True ^
/p:publishUrl=c:\output
You can also target the project via the solution using the /t:SolutionFolder/Project:Target syntax:
msbuild Solution.sln /t:SolutionFolder/ProjectFile:WebPublish ^
/p:Configuration=Release ^
/p:WebPublishMethod=FileSystem ^
/p:DeleteExistingFiles=True ^
/p:publishUrl=c:\output
I gave up trying to get MSBuild to copy deployable web files (and not do anything else but that), so I scripted it in PowerShell and am really happy with the result. Much faster than anything I tried through MSBuild. Here's the gist (literally):
function copy-deployable-web-files($proj_path, $deploy_dir) {
# copy files where Build Action = "Content"
$proj_dir = split-path -parent $proj_path
[xml]$xml = get-content $proj_path
$xml.Project.ItemGroup | % { $_.Content } | % { $_.Include } | ? { $_ } | % {
$from = "$proj_dir\$_"
$to = split-path -parent "$deploy_dir\$_"
if (!(test-path $to)) { md $to }
cp $from $to
}
# copy everything in bin
cp "$proj_dir\bin" $deploy_dir -recurse
}
I don't think you are being specific enough with what you are telling msbuild.
Pulled this out of one of my bookmarks on the subject, hopefully it will help: http://www.digitallycreated.net/Blog/59/locally-publishing-a-vs2010-asp.net-web-application-using-msbuild

Resources