How to properly import JavaFX librarys? - maven

I am using IntellIJ and just created a JavaFX sample project. I have not done any changes to the code but I am getting this Error:
Error: JavaFX runtime components are missing, and are required to run this application
my project.iml:
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="javafx-fxml">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-fxml/16/javafx-fxml-16.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-fxml/16/javafx-fxml-16-win.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-controls/16/javafx-controls-16.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-controls/16/javafx-controls-16-win.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-graphics/16/javafx-graphics-16.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-graphics/16/javafx-graphics-16-win.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/16/javafx-base-16.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/16/javafx-base-16-win.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
Why doesn't the library in project.iml work?

You need to download JavaFX SDK and connect it to the project as a library. See the detailed guide in JetBrains official documentation
and pay attention to this section
And don't forget to define these libraries in VM options of a run configuration in use. See this

Related

Dotfuscator command exited with code 1 xamarin.ios

I am trying to use PreEmptive Solutions - Dotfuscator with my Xamarin.IOS app, but the build fails and I am getting this error:
I have done all the steps from here:
https://www.preemptive.com/obfuscating-xamarin-with-dotfuscator
My Xamarin.Android works fine, but the IOS project fails.
The error:
The command ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\PreEmptive Solutions\Dotfuscator and Analytics Community Edition\dotfuscatorCLI.exe" /p:InDir="obj\iPhone\Release\DotfuscatorXamarin\dfin",OutDir="obj\iPhone\Release\DotfuscatorXamarin\dfout",ReportDir="DotfuscatorReports\iPhone\Release" "DotfuscatorConfig.xml"" exited with code 1.
Any idea how I can fix it?
Update 29-06-2017:
Content of DotfuscatorConfig.xml file for the Xamarin.IOS project
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v2.3.dtd">
<dotfuscator version="2.3">
<propertylist>
<property name="InDir" value="obj\iPhone\Release\DotfuscatorXamarin\dfin" />
<property name="OutDir" value="obj\iPhone\Release\DotfuscatorXamarin\dfout" />
<property name="ReportDir" value="DotfuscatorReports\iPhone\Release" />
</propertylist>
<global>
<option>monocompat</option>
</global>
<input>
<asmlist>
<inputassembly refid="7cf160e1-e28e-4f81-bd8d-f10fdcbcc3f8">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${configdir}\${InDir}" name="MyProject.dll" />
</inputassembly>
<inputassembly refid="2d40ee83-3b30-421c-8b1a-fa4d404fb2d9">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${configdir}\${InDir}" name="MyProject.dll.mdb" />
</inputassembly>
<inputassembly refid="11652964-9a02-4f24-b042-25f260fada88">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${configdir}\${InDir}" name="MyProject.iOS.exe" />
</inputassembly>
</asmlist>
</input>
<output>
<file dir="${configdir}\${OutDir}" />
</output>
<renaming>
<option>xmlserialization</option>
<mapping>
<mapoutput overwrite="true">
<file dir="${configdir}\${ReportDir}" name="Renaming.xml" />
</mapoutput>
</mapping>
<referencerulelist>
<referencerule rulekey="{6655B10A-FD58-462d-8D4F-5B1316DFF0FF}" />
<referencerule rulekey="{7D9C8B02-2383-420f-8740-A9760394C2C1}" />
<referencerule rulekey="{229FD6F8-5BCC-427b-8F72-A7A413ECDF1A}" />
<referencerule rulekey="{2B7E7C8C-A39A-4db8-9DFC-6AFD38509061}" />
<referencerule rulekey="{494EA3BA-B947-44B5-BEE8-A11CC85AAF9B}" />
<referencerule rulekey="{89769974-93E9-4e71-8D92-BE70E855ACFC}" />
<referencerule rulekey="{4D81E604-A545-4631-8B6D-C3735F793F80}" />
</referencerulelist>
</renaming>
<sos mergeruntime="true">
<option>version:v4</option>
<option>disable</option>
<option>dontsendtamper</option>
</sos>
<smartobfuscation>
<smartobfuscationreport verbosity="all" overwrite="true">
<file dir="${configdir}\${ReportDir}" name="SmartObfuscation.xml" />
</smartobfuscationreport>
</smartobfuscation>
</dotfuscator>
And for PreEmptive.Dotfuscator.Xamarin.targets file, I am using the one from the offical website.
PreEmptive.Dotfuscator.Xamarin.targets
As mentioned in the comments to the question, I work for PreEmptive Solutions.
This is a bug in the Dotfuscator-Xamarin targets file (PreEmptive.Dotfuscator.Xamarin.targets), so sorry about that.
Note: This issue has been corrected in version 1.1.0 of the targets file. The latest version of the file can be downloaded on this page.
Specifically, when generating the initial Dotfuscator config file (DotfuscatorConfig.xml), we were treating an MDB (Mono debug symbol) file as an input assembly.
The next version of the targets file will correct this issue.
To resolve this issue with version 1.0.0 of the targets file, please delete the following lines from DotfuscatorConfig.xml:
<inputassembly refid="2d40ee83-3b30-421c-8b1a-fa4d404fb2d9">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${configdir}\${InDir}" name="MyProject.dll.mdb" />
</inputassembly>
The targets file will use your corrected version from then on.

NLog File is not creating After publishing the WEBAPI

I have Used NLog for logging and its working on local but when i published it then its not creating the log file while requesting the API. i have also set the
Copy to output directory = Copy always
Here is NLog.config File
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" >
<!-- optional, add some variabeles
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue"/>
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<target xsi:type="File" name="DebugFile" fileName="${basedir}/logs/Debug_${shortdate}.log" layout="${longdate} ${threadid} ${uppercase:${level}} ${message}"/>
<target xsi:type="File" name="ErrorFile" fileName="${basedir}/logs/Error_${shortdate}.log" layout="${longdate} ${threadid} ${uppercase:${level}} ${message} ${newline} ${exception:format=tostring} ${newline}"/>
<!--
Writing events to the a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
</targets>
<rules>
<!-- add your logging rules here -->
<!--
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
<logger name="*" levels="Debug,Info,Warn" writeTo="DebugFile" />
<logger name="*" level="Error" writeTo="ErrorFile" />
</rules>
</nlog>
Please tell me where i am doing wrong.

Can I use ant war task to export a war built with Maven?

Im using eclipse and maven for my day to day development, which works fine. However I need a specialized war created when its time to export to send over to production, which includes things like minifying and combining js/css etc, separating out static resources for apache rather than tomcat etc.
I tried the maven plugin route but it was a hassle, I'd rather write a simply ant script to export when necessary. I'm using the ant war task, but the exported war contains everything except my WEB-INF/libs folder, which is blank. Does anyone know a way to make the script work with all the libs that maven looks up? This is what I have:
<?xml version="1.0" encoding="UTF-8"?>
<project name="MyProject" default="war" basedir=".">
<property name="builder" value="Me" />
<property name="project-name" value="${ant.project.name}" />
<property name="war-file-name" value="${project-name}.war" />
<property name="source-directory" value="src/main/java" />
<property name="classes-directory" value="target/classes" />
<property name="web-directory" value="src/main/webapp" />
<property name="web-xml-file" value="src/main/webapp/WEB-INF/web.xml" />
<property name="build-directory" value="/" />
<tstamp prefix="build-info">
<format property="current-date" pattern="d-MMMM-yyyy" locale="en" />
<format property="current-time" pattern="hh:mm:ss a z" locale="en" />
</tstamp>
<target name="war" depends="">
<mkdir dir="${build-directory}" />
<delete file="${build-directory}/${war-file-name}" />
<war warfile="${build-directory}/${war-file-name}" webxml="${web-xml-file}">
<classes dir="${classes-directory}" />
<fileset dir="${web-directory}">
<exclude name="WEB-INF/web.xml" />
</fileset>
<manifest>
<attribute name="Built-By" value="${builder}" />
<attribute name="Built-On" value="${build-info.current-date}" />
<attribute name="Built-At" value="${build-info.current-time}" />
</manifest>
</war>
</target>
</project>
You can use maven ant tasks for this. I have not tried this, but from the examples, something like this should work...
<artifact:dependencies filesetId="dependency.fileset" useScope="runtime">
<pom file="pom.xml"/>
</artifact:dependencies>
<copy todir="${webapp.output}/WEB-INF/lib">
<fileset refid="dependency.fileset" />
<!-- This mapper strips off all leading directory information -->
<mapper type="flatten" />
</copy>

Rolling file on utc date rather than server date

This is my log4net.xml file
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="C:\MVC2-" > </file>
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy'-'MM'-'dd'.log'" />
<dateTimeStrategy type="log4net.Appender.RollingFileAppender+UniversalDateTime" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<staticLogFileName value="false" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%utcdate %level %property{requestId} %thread %logger - %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingFile" />
</root>
</log4net>
The log dates are in UTC, but the file rolls over to the next day on server time. This results in some hours of logs being recorded in the wrong file.
How do I make the file roll over depending upon the utc time?
The general answer is that you are going to need to open up log4net and modify it to allow this. However, if you don't want to do all the legwork yourself, you could use the code posted in the link below to use as a jump-start:
http://old.nabble.com/svn-commit%3A-r398209----logging-log4net-trunk-src-Appender-RollingFileAppender.cs-to4156618.html#a4156618

log4net console app not logging on publish

I have a console app using log4net (via Castle Windsor). Everything logs fine to the console when I debug, but when I publish and run the app, nothing is logged.
I have my log4net configuration in a separate file (log4net.config).
I'm thinking it's not finding the config file, but that's just a guess.
I'm a web dev and haven't deployed many console apps. Am I missing something?
Do I need to manually copy the log4net.config file to the exe directory?
I'm on VS2010.
app.config:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" requirePermission="false"/>
</configSections>
<appSettings>
...
<add key="log4net.Internal.Debug" value="false"/>
</appSettings>
<startup>
<supportedRuntime version="v2.0.50727"/></startup>
<castle>
<components>
...
</components>
<facilities>
<facility id="loggingfacility" configfile="log4net.config" loggingapi="log4net" type="Castle.Facilities.Logging.LoggingFacility, Castle.Facilities.Logging"/>
</facilities>
</castle>
</configuration>
log4net.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>
<root>
<!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF -->
<priority value="ALL" />
<appender-ref ref="ConsoleAppender" />
</root>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d: [%-5p] %m%n" />
</layout>
</appender>
<logger name="Castle">
<level value="INFO" />
</logger>
</log4net>
</configuration>
This is a wild guess, but have you marked "Build Action" of your log4net.config file as 'Content', and set it's property "Copy to Output directory" to "Copy always".
This way you don't have to copy file, and this file is considered as 'content' of the build output and will be included in your publish.

Resources