Compiling UMS on Windows

Developers forum for Univeral Media Server-related development (only for programmers)
Amadeus
Posts: 21
Joined: Fri Oct 09, 2015 10:06 pm

Compiling UMS on Windows

Post by Amadeus »

I'm sorry for the lame question; however, I was wondering if I could get some clarification how to compile UMS from source on Windows.

I found this thread, in which SubJunk was providing instructions for Linux:
SubJunk wrote:I haven't compiled it on Linux before but on Windows:

You need Maven, and run the commands:
call mvn com.savage7.maven.plugins:maven-external-dependency-plugin:resolve-external
call mvn com.savage7.maven.plugins:maven-external-dependency-plugin:install-external
call mvn -P linux package
So, my initial questions are:
  1. What is the last line of those instructions for a Windows build?
  2. In which directory of the source do you call these commands? (In the root directory of the repository?)
Thanks!
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: Compiling UMS on Windows

Post by Nadahar »

You do all this from the "repository root", that is the folder in which you find the pom.xml file.

First, make sure you have Maven up and running with:

Code: Select all

mvn -v
I'm currently using 3.3.3, older versions will probably work but I wouldn't be too far behind. Then, run:

Code: Select all

mvn com.savage7.maven.plugins:maven-external-dependency-plugin:resolve-external
mvn com.savage7.maven.plugins:maven-external-dependency-plugin:install-external
This only has to be done once on a given computer, it simply installs some dependencies that Maven can't install the normal way. Then, to build for Windows run:

Code: Select all

mvn package
After this, the installation file will be "<repository root>\target\UMS-setup.exe". You can also run "<repository root>\target\ums.jar" directly if everything else is correctly configured (the installer has been run for a recent version on the computer).
Amadeus
Posts: 21
Joined: Fri Oct 09, 2015 10:06 pm

Re: Compiling UMS on Windows

Post by Amadeus »

This is perfect -- thanks so much!
Amadeus
Posts: 21
Joined: Fri Oct 09, 2015 10:06 pm

Re: Compiling UMS on Windows

Post by Amadeus »

After working with it a bit, I have just a couple more questions:
  1. Is there a command to build only the ums.jar file (without creating the complete installer?) I tried 'mvn compile' but it did not recreate ums.jar.
  2. Is there a setting/command to ensure that I'm building for the correct version of java? I notice that the precompiled UMS has versions for both 7 and 8. (The source I'm using is a clone of https://github.com/UniversalMediaServer ... Server.git.) Or, is the source on github for a specific version of java. OR...should I be source other than what's on github? :)
Thanks!


=====
UPDATE: I just saw this page on github (https://github.com/UniversalMediaServer ... evelopment) I was currently using Eclipse to edit files and then running maven from the command prompt separately. Anyway, I'll try following the instructions on that page -- perhaps it will help answer my first question above.
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: Compiling UMS on Windows

Post by Nadahar »

1) I don't think so, there would have to be created a profile for that in pom.xml and I don't think we have such a profile. It should be possible to run the compiled code though, you'd probably have to configure classpath to get this working, but I don't know as I just compile and run it from Eclipse.
2) We have the Java versions in branches. Master is currently Java 7 but will run on Java 8 as well. There are "Java6" and "Java8" branches, but the Java6 branch is now discontinued (5.2.3 is supposed to be the last Java 6 version).

I haven't followed the guide from the Wiki, getting it up and running in Eclipse is relatively easy. Just make sure that you have Eclipse IDE for Java Developers which should already have the m2e plugin. Go to File -> Import -> Maven -> Existing Maven project and select the repository root folder. The rest of the import can be done with default settings, except that the project name must be "ps3mediaserver" for the "UMS.launch" file to work (yes, UMS.launch should've been updated, but I haven't done it because it would brake it for everyone that use the current project name).

Then, from Eclipse I rightclick pom.xml and select Run As -> Maven install to make sure Eclipse knows of all dependencies. You might need to install additional eclipse packages for m2e, but Eclipse will mostly handle that via wizards. When all that is done, you can just rightclick "UMS.launch" and select "Debug as" - or create a run or debug configuration.
Semir
Posts: 2
Joined: Fri Jan 27, 2017 9:23 pm

Re: Compiling UMS on Windows

Post by Semir »

Hi there,

I've been trying to compile UMS on Windows using Eclipse neon + M2E plugin. Also tried to follow the ancient build guides, however, I did not see the point to install standalone maven.
Used this guide, too: https://github.com/UniversalMediaServer ... evelopment

My troube is, the build fails:

Code: Select all

[WARNING] The POM for jwbroek.cuelib:cuelib:jar:1.2.1-2008-06-13 is missing, no dependency information available
[WARNING] The POM for mediautil:mediautil:jar:1.0 is missing, no dependency information available
[WARNING] The POM for sevenzip:jbinding:jar:4.65-1.04-RC is missing, no dependency information available
[WARNING] The POM for sevenzip-allplatforms:jbinding-allplatforms:jar:4.65-1.04-RC is missing, no dependency information available
I understand that I ought to run commands:

Code: Select all

mvn com.savage7.maven.plugins:maven-external-dependency-plugin:resolve-external
mvn com.savage7.maven.plugins:maven-external-dependency-plugin:install-external
but could anyone let me know how am I supposed to do that with M2E before I get a stroke?

"Then, from Eclipse I rightclick pom.xml and select Run As -> Maven install to make sure Eclipse knows of all dependencies"

it's not enough, fails the same miserable ways..

Thank you!
Semir
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: Compiling UMS on Windows

Post by Nadahar »

I don't know if it's possible to do that "with m2e". You need Maven in some shape or form, and I'm pretty sure m2e does so as well (but it probably doesn't add it to your path). I'd just "install" Maven though, as that's very fast and easy.

The command you have to run isn't that complicated anymore though, the savage7 plugins is no longer used. Instead, you need to run:

Code: Select all

mvn external:install
This is described in pom.xml as well. This command is needed to install dependencies which isn't mavenized (not available from any Maven repo) - and until you do it, all attempts to build will fail.
taconaut
Posts: 38
Joined: Fri Nov 21, 2014 9:00 pm

Re: Compiling UMS on Windows

Post by taconaut »

I've been having issues building UMS for quite some time. I get following error:

Code: Select all

E:\dev\ums\UniversalMediaServer>mvn external:install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Universal Media Server 6.5.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- external-maven-plugin:0.1:install (default-cli) @ ums ---
[INFO] Installing external dependencies into local repository..
[INFO] Downloading artifact sevenzip:jbinding:4.65-1.04-RC:jar from URL http://www.spirton.com/uploads/7-Zip-JBinding/7-Zip-JBinding-4.65-1.04-RC.jar
[INFO] Copying downloaded artifact file to staging path: E:\dev\ums\UniversalMediaServer\target\dependencies\jbinding-4.65-1.04-RC.jar
[INFO] Downloading artifact sevenzip-allplatforms:jbinding-allplatforms:4.65-1.04-RC:jar from URL http://www.spirton.com/uploads/7-Zip-JBinding/7-Zip-JBinding-AllPlatforms-4.65-1.04-RC.jar
[INFO] Copying downloaded artifact file to staging path: E:\dev\ums\UniversalMediaServer\target\dependencies\jbinding-allplatforms-4.65-1.04-RC.jar
[INFO] Downloading artifact jwbroek.cuelib:cuelib:1.2.1-2008-06-13:jar from URL http://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/cuelib/cuelib-1.2.1-2008-06-13.jar
[INFO] Verifying checksum on downloaded file cuelib-1.2.1-2008-06-13.jar8775639172954368492.jar: d03b6b960b3b83a2a419e8b5f07b6ba4bd18387b
[INFO] Verification passed on SHA1 checksum for artifact: jwbroek.cuelib:cuelib:1.2.1-2008-06-13:jar
[INFO] Copying downloaded artifact file to staging path: E:\dev\ums\UniversalMediaServer\target\dependencies\cuelib-1.2.1-2008-06-13.jar
[INFO] Verifying checksum on downloaded file cuelib-1.2.1-2008-06-13.jar: d03b6b960b3b83a2a419e8b5f07b6ba4bd18387b
[INFO] Verification passed on SHA1 checksum for artifact: jwbroek.cuelib:cuelib:1.2.1-2008-06-13:jar
[INFO] Downloading artifact mediautil:mediautil:1.0:jar from URL http://downloads.sourceforge.net/project/mediachest/MediaUtil/Version%201.0/mediautil-1.zip
Feb 02, 2017 12:47:52 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: sf_mirror_attempt="mediachest:freefr:MediaUtil/Version%201.0/mediautil-1.zip"; expires=120; Path=/". Unable to parse expires attribute: 120
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.704 s
[INFO] Finished at: 2017-02-02T12:47:52+01:00
[INFO] Final Memory: 11M/154M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.universalmediaserver:external-maven-plugin:0.1:install (default-cli) on project ums: Failed to download artifact mediautil:mediautil:1.0:jar: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
Using following OS/Maven/Java config:

Code: Select all

E:\dev\ums\UniversalMediaServer>mvn -v
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T18:29:23+01:00)
Maven home: C:\Program Files (x86)\apache-maven-3.2.5
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_91\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"
I'm having this issue when building locally on a windows machine or using jenkins.
I'm surprised Travis continues without errors even though it has the same warning for mediautil.
I've tried getting help from stackoverflow but without luck.

Does external:install work for you? Does anybody know of a fix for this?
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: Compiling UMS on Windows

Post by Nadahar »

I had that problem once, it doesn't have to do with UMS but is something with your locally installed certificates. I don't remember the details, but I was able to solve it from the information I found on stackoverflow.

If I finally manage to finish #1061 MediaUtil will be removed as a dependency, and the same will Imaging which frequently lead to Travis builds failing because the Apache snapshot server where it is located is very unstable and often doesn't reply.

Your Maven version is fairly old though, I have no problem running external:install.
taconaut
Posts: 38
Joined: Fri Nov 21, 2014 9:00 pm

Re: Compiling UMS on Windows

Post by taconaut »

It makes sense that it's the certificates defined in the java keystore, both jenkins and local maven builds point to the same jvm. But I haven't been able to figure out how to solve it.
I had a more recent maven version but went back to this one as I've noticed the Travis build worked with it and hoped it would solve my issue.
Post Reply