Build Failure on Linux - EnforcerRuleException

Developers forum for Univeral Media Server-related development (only for programmers)
User avatar
Sami32
Posts: 819
Joined: Mon Apr 11, 2016 5:09 am

Re: Build Failure on Linux - EnforcerRuleException

Post by Sami32 » Tue May 16, 2017 2:12 am

@Nadahar Exactly, a configuration one. A simple command line should fix it, but i prefer wait for user feedback first.

J.L.C.
Posts: 9
Joined: Mon May 08, 2017 2:51 am

Re: Build Failure on Linux - EnforcerRuleException

Post by J.L.C. » Tue May 16, 2017 6:12 am

Sami32 wrote:@J.L.C. In your case, a safer workaround, until this issue found a real solution, should be:

Code: Select all

mvn -Dtest=\!UMSUtilsTest.setUp package
Do any of these builds work for you without workaround ?

Code: Select all

git checkout dcbec3f && mvn package
git checkout a3aa8b7 && mvn package
git checkout f2c1099 && mvn package
git checkout 556f4eb && mvn package
git checkout 9372945 && mvn package
If not, do building under Java 7 make any difference ?
I am not able to check out any of the suggested builds.

I get an error:

Code: Select all

Error: Could not find or load main class ”-Xms256m 

J.L.C.
Posts: 9
Joined: Mon May 08, 2017 2:51 am

Re: Build Failure on Linux - EnforcerRuleException

Post by J.L.C. » Tue May 16, 2017 8:56 am

I made some changes to my environment path and was able to try the above versions. But, they all fail, typically with some version of:

Code: Select all

[WARNING] The POM for sevenzip-allplatforms:jbinding-allplatforms:jar:4.65-1.04-RC is missing, no dependency information available

User avatar
Sami32
Posts: 819
Joined: Mon Apr 11, 2016 5:09 am

Re: Build Failure on Linux - EnforcerRuleException

Post by Sami32 » Tue May 16, 2017 9:48 am

J.L.C. It seem to me that your environment and directory are a total mess.

Could post the result of this command line:

Code: Select all

mvn -v
could you post the exact full command line you type when building with Maven ?

Nadahar
Posts: 1232
Joined: Tue Jun 09, 2015 5:57 pm

Re: Build Failure on Linux - EnforcerRuleException

Post by Nadahar » Tue May 16, 2017 11:24 am

@J.L.C. You get the above error because you don't have that artifact in your local Maven repository. When Maven downloads artifacts, it stores them in the local repo, found under a folder named "m2" or ".m2" somewhere, usually in your home folder. Usually you should already have those artifacts there from previous builds. Maven download most of the dependencies automatically, but we have some dependencies which isn't available in an online Maven repository. Everybody must run this command once before building UMS (and again if any of those dependencies change versions):

Code: Select all

mvn external:install
Once that is done, given that your Maven installation is operational, jbinding and a couple of other artifacts is installed to your local Maven repo and the build should proceed.

J.L.C.
Posts: 9
Joined: Mon May 08, 2017 2:51 am

Re: Build Failure on Linux - EnforcerRuleException

Post by J.L.C. » Tue May 16, 2017 3:17 pm

Sami32 wrote:J.L.C. It seem to me that your environment and directory are a total mess.

Could post the result of this command line:

Code: Select all

mvn -v
could you post the exact full command line you type when building with Maven ?
I have tried:

Code: Select all

sudo mvn package

Code: Select all

sudo mvn clean package
and the one that succeeds:

Code: Select all

sudo mvn package -DskipTests
I'm building on a headless server in /usr/local/UMS/

Code: Select all

mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T15:39:06-04:00)
Maven home: /usr/local/apache-maven/apache-maven-3.5.0
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-1.b12.fc24.x86_64/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "4.10.11-100.fc24.x86_64", arch: "amd64", family: "unix"
Nadahar wrote:@J.L.C. You get the above error because you don't have that artifact in your local Maven repository. When Maven downloads artifacts, it stores them in the local repo, found under a folder named "m2" or ".m2" somewhere, usually in your home folder. Usually you should already have those artifacts there from previous builds. Maven download most of the dependencies automatically, but we have some dependencies which isn't available in an online Maven repository. Everybody must run this command once before building UMS (and again if any of those dependencies change versions):

Code: Select all

mvn external:install
Once that is done, given that your Maven installation is operational, jbinding and a couple of other artifacts is installed to your local Maven repo and the build should proceed.
I have started each attempt at building with

Code: Select all

sudo mvn external:install


That part always succeeds without error.
Last edited by J.L.C. on Tue May 16, 2017 3:42 pm, edited 2 times in total.

Nadahar
Posts: 1232
Joined: Tue Jun 09, 2015 5:57 pm

Re: Build Failure on Linux - EnforcerRuleException

Post by Nadahar » Tue May 16, 2017 3:25 pm

Then I don't see any other possibility than that there is something wrong with your Maven installation. I don't know how you installed 3.5.0, it's not available in the package manager yet so I placed in in /usr/local/shared and then created a symlink to the binary from /usr/local/bin. If you have done something similar, "uninstalling" it is as simple as deleting the symlink. I would go back to 3.3.9 or whatever the latest version in the package manager is, and then uninstall and install Maven.

You should also locate the ".m2" folder and browse it to see what artifacts are there and not. If the artifact really isn't there, "mvn external:install" must fail in some way. If that's the case, run "mvn -X external:install > filename" and attach the output file here.

J.L.C.
Posts: 9
Joined: Mon May 08, 2017 2:51 am

Re: Build Failure on Linux - EnforcerRuleException

Post by J.L.C. » Tue May 16, 2017 3:46 pm

mvn external:install seems to complete, but with some warnings:

Code: Select all

sudo mvn external:install

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for net.pms:ums:jar:6.6.1-SNAPSHOT
[WARNING] Reporting configuration should be done in <reporting> section, not in maven-site-plugin <configuration> as reportPlugins parameter. @ line 770, column 20
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[WARNING] The project net.pms:ums:jar:6.6.1-SNAPSHOT uses prerequisites which is only intended for maven-plugin projects but not for non maven-plugin projects. For such purposes you should use the maven-enforcer-plugin. See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building Universal Media Server 6.6.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- external-maven-plugin:0.2: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: /usr/local/UMS/ums-latest/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: /usr/local/UMS/ums-latest/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.jar3893079864942770850.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: /usr/local/UMS/ums-latest/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] Deleting temporary download files
[INFO] Finished installing all external dependencies into local repository
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.750 s
[INFO] Finished at: 2017-05-15T23:45:21-04:00
[INFO] Final Memory: 14M/217M
[INFO] ------------------------------------------------------------------------
It looks like the main error is:

Code: Select all

Running net.pms.util.UMSUtilsTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.296 sec <<< FAILURE! - in net.pms.util.UMSUtilsTest
testPlayedDurationStr(net.pms.util.UMSUtilsTest)  Time elapsed: 0.296 sec  <<< ERROR!
java.lang.ExceptionInInitializerError
	at net.pms.util.UMSUtilsTest.setUp(UMSUtilsTest.java:24)
Caused by: java.lang.NullPointerException
	at net.pms.util.UMSUtilsTest.setUp(UMSUtilsTest.java:24)

Last edited by J.L.C. on Tue May 16, 2017 4:02 pm, edited 1 time in total.

Nadahar
Posts: 1232
Joined: Tue Jun 09, 2015 5:57 pm

Re: Build Failure on Linux - EnforcerRuleException

Post by Nadahar » Tue May 16, 2017 4:01 pm

I see no errors there, the warnings in the beginning doesn't really matter and should be fixed in latest master.

external:install seems to have done it's job. Just so you know it, you don't have to run this every time you build UMS. These dependencies rarely change (in fact, I'm trying to replace them with "mavenized" versions if possible).

If it still complains about not finding sevenzip-allplatforms when trying to build, you should check in your .m2 folder if the file is really there or not. I don't know exactly what to suggest, I've never seen basic things like this failing before. There must be something very fundamental going wrong. Could there be permission issues here, do you run some commands with sudo and others without? If you have write permission to the "UniversalMediaServer" and it's subfolders you shouldn't need to use sudo. Since the ".m2" folder is in your home folder by default, you could end up using two different Maven repositories depending on if you use sudo or not. I run all git and Maven commands without using sudo when I have given myself write permission to the repository folder and subfolders.

You could also run "printenv" and see if there are any "maven" environment variables set. I think that M2 can be redirected using an environment variable, which could be bad if the user you're using doesn't have write permission to the ".m2" folder.

J.L.C.
Posts: 9
Joined: Mon May 08, 2017 2:51 am

Re: Build Failure on Linux - EnforcerRuleException

Post by J.L.C. » Tue May 16, 2017 4:18 pm

You nailed it!

It was a permission problem. The directory I build in was owned by root, so there an incompatible mix of things going on. I changed the ownership to the user I log in with and everything built successfully.

A little ridiculous (and embarrassing!) that all that debugging was for a permissions problem :oops:

Thank you all for the help!

Post Reply