sbt resources not copied - resources

It appears as though sbt (1.2.1, 1.2.3) is not copying resource files (from src/main/resources) to the target directory.
The build is multi-project, with a root project that aggregates subprj1 (for now).
Showing below: project structure (main directories and one resource file: application.conf), the resourceDirectory as proof that we have not overridden it, proof of successful compilation - and yet the application.conf file has not been copied to the output (target) directory.
Tried sbt versions 1.2.1, 1.2.3.
Why are the resources not being copied to the output, since we are complying with the standard directory structure?
Project structure
/main/project/home/dir/build.sbt
/main/project/home/dir/subprj1/src/main/resources
/main/project/home/dir/subprj1/src/main/resources/application.conf
/main/project/home/dir/subprj1/src/main/scala/com/myco/foo/bar/server/*.scala
IJ][subprj1#master] λ show resourceDirectory
[info] subprj1 / Compile / resourceDirectory
[info] /main/project/home/dir/subprj1/src/main/resources
build/sbt clean compile
...
[success] Total time: 22 s, completed Feb 8, 2019 3:10:04 PM
find . -name application.conf
./subprj1/src/main/resources/application.conf
It works if we run copyResources after compile, but why is that not automatic?
build/sbt copyResources
find . -name application.conf
./subprj1/src/main/resources/application.conf
./subprj1/target/scala-2.12/classes/application.conf
I can inspect the dependencies among tasks and I can see that compile does not depend on copyResources, but was it always like this, or is this a recent change? I have been using sbt for years, and I have this expectation that the build would copy resources to output automatically.
build/sbt -Dsbt.log.noformat=true "inspect tree compile" > t.txt

It turns out someone had added the settings below to build.sbt. Once I commented out these lines, the resources started being copied to the output directory.
, unmanagedResourceDirectories in Compile := Seq()
, unmanagedResourceDirectories in Test := Seq()

Related

MoveFileEx with MOVEFILE_REPLACE_EXISTING flag Fails with LastError = 183

We have an application that makes a backup of a configuration file by copying it to a sub-folder (see log file entry below) using the following command:-
BOOL b = MoveFileEx(ExistingFileSpec, NewFileSpec, MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH | MOVEFILE_COPY_ALLOWED);
This appears to work as expected on most systems but on two we get the following warning in our log file:-
11 Jun 2018 10:58:05.437 W. COMMON WARNING MoveFile failed on C:\Program Files\Configuration\Stores.xml to C:\Program Files\Configuration\Backup\Stores.xml LastError=183
Lasterror =183 means "ERROR_ALREADY_EXISTS"
This is odd since MOVEFILE_REPLACE_EXISTING is specifically meant to enable this command to work when the target file exists.
This is happening on Win7 x86 machines.
In a previous version of the code MoveFile was used but with a DeleteFile call immediately prior to ensure the target file did not exist. When the code was rolled back to this version it works.
Any suggestions?

Veracode through an error - ASPCONFIG: Could not autodiscover 'components.config'

I have a Veracode plugin in my VS 2013 Professional.
I have ucommerce.dll, Sitecore.Kernel and Sitecore.Analytics.dll
I set copy local true for all above dll files.
When i tried to pre-compile all the web project I'm getting a below error message
1>------ Pre-compile started: Project: XXXXX.Web.PQRPorta\ ------
1>Pre-compiling with command similar to the following:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -p
"C:/XXXXX.Web.PQRPortal" -v "XXXXX.Web.PQRPortal/" -fixednames -f -c
-d "C:/SVN/trunk/Releases/SourceCode/Source/PrecompiledWeb/XXXXX.Web.PQRPortal"
1>error ASPCONFIG: Could not autodiscover 'components.config'. Make
sure it's present in the application folder
'C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\' or in a
sub folder. Paths ignored
''C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\bin',
'C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\App_Data',
'C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\obj''
1>XXXXX.Web.PQRPortal\ - 1 error, 0 warnings
Is there any configuration missing?
Update
I found the components.config file inside
C:\inetpub\wwwroot\XXXX\Website\sitecore modules\Shell\uCommerce\Configuration
and I added the file inside the web project root directory and tried to precompile web project, now I’m getting different error error
ASPRUNTIME: Type is not resolved for member 'Castle.Windsor.Configuration.Interpreters.ConfigurationProcessingException,Cast‌​le.Windsor, Version=3.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'.
any solution for it?
The components.config is a file uCommerce need.
The configuration file should be placed somewhere below the uCommerce folder. (not sure where depend on the version) It will automatically be picked up when the application starts up.

Sonar-Runner 2.4 can't find code coverage reports

I'm running SonarQube 5.2 with SonarRunner v2.4 (MSBuild) and am having issues getting SonarRunner to pick up the code coverage reports. I have VS Test which drops the TestResults folder within the source directory. The TRX file is within the TestResults folder. Is there a default directory that Sonar-Runner scans to search for the TRX/code coverage reports? The build succeeds but there are no unit test coverage results in SonarQube for the app.
TRX: F:\Builds\50\IT\ABCDemo.Nightly\src\TestResults\ *.TRX
Source:
F:\Builds\50\IT\ABCDemo.Nightly\src
Process:
SonarRunner begin //with key,name,version filled in
MSBuild executes
VS Test executes and drops TestResults folder within src directory.
SonarRunner end
Issue:
MSBuild SonarQube Runner Post-processor 1.0.2.0
09:22:57.327 Fetching code coverage report information from TFS...
09:23:17.723 No code coverage reports were found for the current build.
EDIT: I've included the .TRX and .coveragexml files using /d: but I still get the issue saying no code coverage reports were found.
I can see in the logs that it does:
09:51:59.875 INFO - Parsing the Visual Studio coverage XML report f:\Builds\50\IT\ABCDemo.Nightly\src\VisualStudio.coveragexml
09:53:07.737 INFO - Parsing the Visual Studio Test Results file f:\Builds\50\IT\ABCDemo.Nightly\src\TestResults\tfsbuildagent_QL1CIBUILD3 2015-12-03 09_51_33.trx
These occur near the end of sonar analysis.
Resolved by:
Included the paths to the files for trx and coveragexmls within the arguments for sonar-runner.
MSBuild.SonarQube.Runner.exe begin
/k:projectkey /n:projectname /v:projectversion
/d:sonar.cs.vstest.reportsPaths="path\to\ *.trx"
/d:sonar.cs.vscoveragexml.reportsPaths="path\to\VisualStudio.coveragexml"
Moved the /'s around for better visual.

Which directory contains third party libraries for Spark

When we use
spark-submit
which directory contains third party libraries that will be loaded on each of the slaves? I would like to scp one or more libraries to each of the slaves instead of shipping the contents in the application uber-jar.
Note: I did try adding to
$SPARK_HOME/lib_managed/jars
But the spark-submit still results in a ClassNotFoundException for classes included in the added library.
Hope these points will help you.
$SPARK_HOME/lib/ [contains the jar files ]
$SPARK_HOME/bin/ [contains the launch scripts - Spark-Submit,Spark-Class,pySpark,compute-classpath.sh etc]
Spark-Submit ---will call ---> Spark-Class.
Spark-class internally calls compute-Classpath.sh before executing / launching the job.
compute-Classpath.sh will pick the jars availble in $SPARK_HOME/lib to CLASSPATH.
(execute ./compute-classpath.sh //returns jars in lib dir)
So try these options.
option-1 - Placing user-specific-jars in $SPARK_HOME/lib/ will works
option-2 - Tweak compute-classpath.sh so that it will be able to pic
your jars specified in a user specific jars dir

IDL Compilation with m2e fails, but no error

I've got a working Maven project setup includuing IDL compilation with the org.codehaus.mojo:idlj-maven-plugin. If I'm running mvn compile on my console, the IDL compiler works just fine. If I do this in Eclipse Indigo (3.7.2) with m2e (1.0.1), first I get the following messages (orignal paths replaced with ~~~):
18.05.12 13:13:55 MESZ: [INFO] Processing 1 grammar files to ~~~/target/generated-sources/idl
18.05.12 13:13:55 MESZ: [DEBUG] Processing: ~~~/src/main/idl/MyRegistry.idl
This is the same I get on my console along with the same configuration parameter infos.
But at the end of the m2e process I get this line:
18.05.12 13:13:55 MESZ: [DEBUG] Created marker 'IDL Compilation failure (org.codehaus.mojo:idlj-maven-plugin:1.1:generate:default:generate-sources)' on resource '/mypackage.myregistry/pom.xml'.
But there is no error or something like this showing up indicating what went wrong.
In Eclipse I already switched the Maven runtime from internal to the external one I use also on the console.

Resources