Building Question

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

Building Question

Post by Amadeus »

Is there a way to build UMS in a way that it creates the files and directory structure that's included in the 'distribution.tar' ..but, not tarred and not gzipped? In other words, I'd love to have a setup in which I could build and then run UMS right away from the files that are created by the build process ....make sense?

I mean, I know I could simply have an "install location" with the files/configuration/etc. from the distribution.tar.gz ...and then use a symbolic link to the ums.jar that is created with each build; however, how would one know if/when one of the renderer or web files changed?

Anyway, maybe I'm missing something? (I'm a total newbie with maven.)
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: Building Question

Post by Nadahar »

I'm sure there is, the files are not packaged until the "package phase" (Maven term). If you e.g. ran "mvn compile" I'd think you'd find the structure under the "target" folder somewhere.

Even easier though, depending on what you goal is, is to Install Eclipse with the M2E plugin. Then you can simply start UMS from Eclipse, and Eclipse will compile as needed and then start UMS. It's great for testing and developing, but not they way to go if what you want to achieve is to always run the latest snapshot.
Amadeus
Posts: 21
Joined: Fri Oct 09, 2015 10:06 pm

Re: Building Question

Post by Amadeus »

Hmm ... 'mvn compile' didn't seem to do very much other than create the .class files.

Code: Select all

apollo::root:/usr/UniversalMediaServer> mvn compile
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Universal Media Server 6.0.0-a2
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- git-commit-id-plugin:2.1.15:revision (default) @ ums ---
[INFO] 
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ ums ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 231 resources to resources
[INFO] Copying 1 resource to resources
[INFO] Copying 1 resource to ..
[INFO] 
[INFO] --- maven-antrun-plugin:1.7:run (process-resources-linux) @ ums ---
[INFO] Executing tasks

main:
    [mkdir] Created dir: /usr/UniversalMediaServer/target/bin
      [get] Getting: http://universalmediaserver.com/svn/binaries/linux/ffmpeg?p=33
      [get] To: /usr/UniversalMediaServer/target/bin/ffmpeg
      [get] Getting: http://universalmediaserver.com/svn/binaries/linux/ffmpeg64?p=33
      [get] To: /usr/UniversalMediaServer/target/bin/ffmpeg64
      [get] Getting: http://universalmediaserver.com/svn/binaries/linux/tsMuxeR?p=33
      [get] To: /usr/UniversalMediaServer/target/bin/tsMuxeR
      [get] Getting: http://universalmediaserver.com/svn/binaries/linux/tsMuxeR-new?p=33
      [get] To: /usr/UniversalMediaServer/target/bin/tsMuxeR-new
      [get] Getting: http://universalmediaserver.com/svn/binaries/linux/tsMuxeR_licence.txt?p=33
      [get] To: /usr/UniversalMediaServer/target/bin/tsMuxeR_license.txt
[INFO] Executed tasks
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ ums ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 278 source files to /usr/UniversalMediaServer/target/classes
[INFO] /usr/UniversalMediaServer/src/main/java/net/pms/dlna/DLNAResource.java: Some input files use or override a deprecated API.
[INFO] /usr/UniversalMediaServer/src/main/java/net/pms/dlna/DLNAResource.java: Recompile with -Xlint:deprecation for details.
[INFO] /usr/UniversalMediaServer/src/main/java/net/pms/network/UPNPControl.java: Some input files use unchecked or unsafe operations.
[INFO] /usr/UniversalMediaServer/src/main/java/net/pms/network/UPNPControl.java: Recompile with -Xlint:unchecked for details.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.005 s
[INFO] Finished at: 2015-12-01T23:35:51-08:00
[INFO] Final Memory: 33M/243M
[INFO] ------------------------------------------------------------------------
apollo::root:/usr/UniversalMediaServer> cd target/
I'm compiling in Linux and don't plan to be using Eclipse, so that's why I'm not using the Eclipse plugins to do this automatically.

Yea, I just want to be able to run the latest version on github (on linux.) So, I'm looking for an easy way to compile so that I get the contents of the distribution tar.gz in a directory. I don't mind if it's somewhere in /target ...I would just prefer to avoid the hassle of having to 'mvn package', then write a script to unpack the tar.gz, etc. ...just seemed like there should be an easier way.

Thanks!
taconaut
Posts: 38
Joined: Fri Nov 21, 2014 9:00 pm

Re: Building Question

Post by taconaut »

I don't think there is an easier solution than to build the package and unzip its contents, as the packaged content is being grabbed from different locations.
Another solution would be to download the packaged snapshot version and unpack it. You won't have to build it yourself but have to download it.
Wolfgan
Posts: 370
Joined: Fri Feb 08, 2013 12:33 am

Re: Building Question

Post by Wolfgan »

Did you try UMS Builder? viewtopic.php?f=25&t=1782
It pulls everything and leave sources and external components in a folder structure that mimics the installation architecture.
-- UMS serving PS3, WDTV, Samsung H6400 + J5500 and Kalemsoft renderers! (no video transcoding but remuxing accepted :D )
Amadeus
Posts: 21
Joined: Fri Oct 09, 2015 10:06 pm

Re: Building Question

Post by Amadeus »

I just tried UMSBuilder. It does the same thing as building the package with maven. After it is finished you have a .tar.gz file with the installation in it. Honestly, it's just a wrapper for the git system and maven so that a user would not have to know any git or maven commands.

To be honest, the .tar.gz file would be fine for me (I could just write something to extract it after the compile); however, it is stored within a directory structure in the tar file ...so, it just would be ugly to hack something together to do what I want.

I'm surprised that this question has never come up before. It seems like the most logical way to compile, as a developer, would be to have the compilation/build/package process create everything in a directory before it's put into a .tar.gz file for distribution.


I guess if we don't have any pom.xml experts that could make a reasonable build target for just getting everything that's in the .tar.gz in a "release" directory (or something along those lines), then I guess I'll just do my testing with an unchanging "release" directory structure (based on the major version) and then just link to the compiled version of the ums.jar for whatever commit I'm testing. It's ugly and hackish, but seems to be the only reasonable way that I can see to do it without using the Eclipse plugins that I guess everyone is using.
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: Building Question

Post by Nadahar »

I still don't know what your goal is, and why you don't want to use Eclipse.

When it comes to building the directory structure first and then pack it, I though that was what Maven actually did. But, why would we want to do this when Maven handles it for us? You can also run the .jar file found in target/ directly, although UMS will look for some external files (like the .conf files, logback.xml etc).

If the only thing that will satisfy your need is to get the unpacked directory structure directly, you'll probably have to modify the commands for the maven-assemble-plugin. It's not what I'd consider a good solution though, as your changes wouldn't exist in the source repo and you'd end up with a "dirty" git tree that would need a merge or a reset when switching to a different version.
infidel
Developer
Posts: 571
Joined: Thu Jul 12, 2012 5:37 am

Re: Building Question

Post by infidel »

Amadeus wrote:I'm surprised that this question has never come up before.
I've been running ums jar-lessly off the 'target/classes' folder for years using a quick-compile setup, which allows you to run ums after just doing mvn compile. There I describe how to do it for Windows, but in linux it's essentially the same. The basic idea is:
  • create a symlink to target/classes/ in your ums program folder.
  • similarly, create another symlink to the current 'jar with dependencies' of your target/ folder, calling it e.g. dev.jar.
  • create a umstest script in your ums program folder that starts ums with your 'dev' classpath like so:

    Code: Select all

    CP="classes:dev.jar:update.jar:ums.jar"
    exec "$JAVA_HOME/bin/java" -Xmx768M -Xss16M -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -classpath "$CP" net.pms.PMS
    
  • now you can do just 'mvn compile' and then 'umstest' to run ums immediatly. You'll probably want to write a fancier build script to combine it into one command and do other stuff before/after :).
Amadeus
Posts: 21
Joined: Fri Oct 09, 2015 10:06 pm

Re: Building Question

Post by Amadeus »

Infidel -- your solution is a good idea. Thanks!

I just have one question, you refer to utilizing my "ums program folder" as a base directory for the symlinks and the script that runs the file. However, how can I confirm that the files I'm using in THAT directory are the most up-to-date? (I'm talking about the "renderers" directory, the "plugins" directory, the "web" directory, etc.)

I guess this was always my question. Building the ums.jar, etc. wasn't too difficult, but I was just surprised that there was no version of the "ums program folder" anywhere to be found on the repository or after building. Know what I'm saying?
Wolfgan
Posts: 370
Joined: Fri Feb 08, 2013 12:33 am

Re: Building Question

Post by Wolfgan »

Amadeus wrote:I just tried UMSBuilder. It does the same thing as building the package with maven. After it is finished you have a .tar.gz file with the installation in it. Honestly, it's just a wrapper for the git system and maven so that a user would not have to know any git or maven commands.
I did edit the UMSbuilder script to comment out all the "clean" commands after the build is successful, and it seems that everything remains in the folder structure.
-- UMS serving PS3, WDTV, Samsung H6400 + J5500 and Kalemsoft renderers! (no video transcoding but remuxing accepted :D )
Post Reply