Remove "No main class detected" warning in SBT - sbt

I have a multi-module SBT project. Some of the modules produce JARs with main classes and can be started with java -jar but most don't.
However when I run (or compile, or anything else) one of the modules (sbt foo/run) I get a warning per library module.
[warn] No main class detected
How can I remove those warnings?

This warning is considered a bug in sbt 0.13.7 and it will be removed in sbt 0.13.8.

Related

opendaylight: using external jar file

I am developing an application on opendaylight Carbon (based on Karaf). I need to use a library (specifically dnsjava) in my bundle. How do I go about including this?
I tried the following which did not work:
In my features/pom.xml, I included a mvn dependency for my jar file.
In my features/src/main/features/features.xml, I added a bundle:
<bundle>wrap:mvn:dnsjava/dnsjava/${dnsjava.version}</bundle>
However, I still have an error when I go to start my feature:
Error executing command: Error executing command on bundles:
Unable to execute command on bundle 278: The bundle "gov.nist.sdnmud.impl_0.1.0.SNAPSHOT [278]" could not be resolved. Reason: Missing Constraint: Import-Package: org.xbill.DNS; version="[2.1.0,3.0.0)"
Thanks for any help.
I'm not an expert, but if the artifact doesn't have OSGi properties in the jar, which is likely why you've added the "wrap" prefix, then you have to manually set the required OSGi properties on the features.xml dependency line, in an odd microformat syntax.
In our environment, we have to do something like this:
wrap:mvn:<group>/<artifact>/<version>$Bundle-SymbolicName=<bundlename>&Bundle-Version=<version>
This issue doesn't have anything to do with opendaylight.

sbt unresolved dependency publishing to nexus

I publish my project to nexus/sonatype staging repo. Then I try to pull that dependency with sbt update on another project.
I get an unresolved dependency error. sbt shows me all the directories it tried, including the path for the staging repo I expected to succeed.
I initially thought it was a deployment/delay thing with nexus (waiting for the package to propagate) but I can reliably hit the same pom file link that sbt says failed from a browsers with no problems (cut 'n paste the precise URL).
Does sbt have some kind of resolution cache not cleared by a clean?
If the pom can be downloaded from Nexus then the issue isn't with Nexus, it is with SBT. You might try explicitly running update from SBT to clear it's cache.

Add JavaFX (of JDK8) in sbt (using the play framework)

The goal is to have a standalone Play Framework (2.2) application having an additional status window open containing some javafx (javafx-8) elements.
Since JavaFX classes are now on the default runtime classpath for an Oracle Java 8 implementation using javafx.* in my classes and compiling with sbt should just be fine.
However sbt can't find these classes and quits with
play.api.UnexpectedException: Unexpected exception[NoClassDefFoundError: javafx/application/Application]
when executing
..\path-to-play-framework-2.2\play project run
The best way to fix this problem seems to be the modification of build.sbt in the project directory. What can I do to add the missing (class) path?
Sadly JavaFX doesn't link that easily to an sbt build. You need to set your JAVA_HOME environment variable and do modifications to your build file.
Here I have a repository where this is set up. The important bit if you are using an sbt build rather than a scala build is this one:
unmanagedJars in Compile += Attributed.blank(
file(System.getenv("JAVA_HOME") + "/jre/lib/jfxrt.jar")),
fork in run := true
The reason for this is that jfxrt.jar is the archive containing the JavaFX runtime and it is not included in the classpath of an sbt project by default.
Anotherway is to set the Classpath for sbt. This can be done on the machines which can't resolve JavaFX.
SBT_OPTS="-Xbootclasspath/p:/usr/share/java/openjfx/jre/lib/ext/jfxrt.jar"

Qt apps break after build on MinGW

When I build Qt 4.8.2 it builds successfuly. But when I run any Qt pre-built apps (qtdemo.exe, designer.exe etc) it throws a procedure entry point error.
This is what it says:
I just can't get it to work!
I have build debug and release DLLs, without Phonon, Script, Qt3support, or webkit.
I opened the app in Dependency Walker and this is what it said in bold red text:
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with
different CPU types were found.
Warning: At least one delay-load
dependency module was not found. Warning: At least one module has an
unresolved import due to a missing export function in a delay-load
dependent module.
The problem occurs when there is another version of the QtCore4.dll in you system PATH. You can get around this by copying the newly compiled dll's into the same directory as the executable, so that it finds the correct version.
You could search your system for QtCore4.dll to see which program(s) installed the conflicting files.

SBT 0.10.0/0.10.11 -- Potentially incompatible versions specified

I'm getting an error when running SBT, which I don't know where it originates from:
[info] Set current project to root (in build file:/home/dcs/.sbt/plugins/)
[warn] Potentially incompatible versions specified:
[warn] org.scala-tools.sbt: 0.10.1, 0.10.0
The JAR file for the sbt laucher is version's 0.10.1. The error happens even outside projects, such as when running screpl.
How do I fix it?
Do you have a build.sbt in /home/dcs/.sbt/build.properties that sets a particular sbt.version?
If not, you may have a global plugin installed that requires 0.10.0 as mentioned at https://groups.google.com/forum/#!topic/simple-build-tool/YoXd0Tp_cjo/discussion. The solution there was to wipe the global .sbt directory (your /home/dcs/.sbt).

Resources