openequella / openEQUELLA

Core openEQUELLA sources
https://openequella.github.io/
Apache License 2.0
42 stars 44 forks source link

Couldn't able to build the installer from build.sbt #4462

Closed saiKapilBunni-zessta closed 1 year ago

saiKapilBunni-zessta commented 2 years ago

I'm trying to build the installer from build.sbt under the folder installer. But, getting errors.

To Reproduce To reproduce try to run command sbt run under the path "\openEQUELLA\installer"

Expected behavior This should build an installer.zip through which we can run the application.

Stacktrace PS C:\Program Files (x86)\sbt\bin\openEQUELLA\installer> sbt package [info] welcome to sbt 1.7.3 (Oracle Corporation Java 1.8.0202) [info] loading settings for project installer-build from assembly.sbt ... [info] loading project definition from C:\Program Files (x86)\sbt\bin\openEQUELLA\Installer\project C:\Program Files (x86)\sbt\bin\openEQUELLA\Installer\build.sbt:40: error: not found: value installerZip installerZip := { ^ C:\Program Files (x86)\sbt\bin\openEQUELLA\Installer\build.sbt:53: error: type mismatch; found : Seq[(Comparable[ >: String with java.io.File <: java.io.Serializable] with java.io.Serializable, String)] required: Traversable[(java.io.File, String)] IO.zip(allFiles.map(t => (t._1, s"equella-installer-2022.1.0/${t._2}")), ^ [error] Type error in expression [warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r) Platform: cloned the code from openequella repo

edalex-ian commented 2 years ago

Hey there @kapil-bunni

I'd suggest you have a look at CONTRIBUTING.md as it covers details around building.

But a few things to note:

  1. We don't really support the Windows based build - as we all pretty well build on linux - however it can be done (in theory);
  2. Your version of SBT might be too new - not we normally use the SBT wrapper in ./sbt and that's currently at about 1.5.3; and
  3. Lastly, if you want an installer you typically do that from the root of the repository simply with ./sbt installerZip - but note the use of the wrapper so you might just want to try sbt installerZip and if your SBT is correct you might be fine.

Let us know how you get on.

averyirin commented 1 year ago

Good day all,

I'm getting similar build errors when following the contributors guidelines.

In order to be easily reproducible - I've build a docker ubuntu image using ubuntu 20.04 as per contributor guidelines.

Please see attached equella ubuntu instructions.txt - the docker instructions installer zip error.txt (below for ease of reference) - the error received from running the ./sbt installerZip from the root of the directory

equella ubuntu instructions.txt

installer zip error.txt

root@3e6cc573b860:/openEQUELLA-2022.2.0# ./sbt installerZip [info] welcome to sbt 1.5.6 (Oracle Corporation Java 1.8.0_302) [info] loading settings for project openequella-2022-2-0-build from plugins.sbt ... [info] loading project definition from /openEQUELLA-2022.2.0/project [info] loading settings for project equella from build.sbt ... [info] loading settings for project learningedge_config from build.sbt ... [info] loading settings for project autotest from build.sbt ... [info] loading settings for project equellaserver from build.sbt ... [info] loading settings for project adminTool from build.sbt ... [info] loading settings for project conversion from build.sbt ... [info] loading settings for project UpgradeInstallation from build.sbt ... [info] loading settings for project UpgradeManager from build.sbt ... [info] loading settings for project Installer from build.sbt ... [info] loading settings for project com_tle_web_adminconsole from build.sbt ... [info] loading settings for project com_equella_reporting from build.sbt ... [info] loading settings for project com_equella_z3950 from build.sbt ... [info] loading settings for project com_equella_oai from build.sbt ... [info] loading settings for project com_tle_web_filemanager_applet from build.sbt ... [info] loading settings for project com_equella_srw from build.sbt ... [info] loading settings for project com_equella_core from build.sbt ... [info] loading settings for project org_eclipse_birt_osgi from build.sbt ... [info] loading settings for project UpgradeInstallation from build.sbt ... [info] loading settings for project UpgradeManager from build.sbt ... [info] loading settings for project com_tle_common_applet from build.sbt ... [info] loading settings for project org_hibernate from build.sbt ... [info] loading settings for project com_tle_platform_equella from build.sbt ... [info] loading settings for project IntegTester from build.sbt ... [info] loading settings for project Tests from build.sbt ... [info] loading settings for project OldTests from build.sbt ... [info] loading settings for project adminConsoleJar from build.sbt ... [info] loading settings for project filemanagerApplet from build.sbt ... [info] loading settings for project inplaceEditorJar from build.sbt ... [info] resolving key references (40205 settings) ... [info] Loading config from: /openEQUELLA-2022.2.0/autotest/config/resources/application.conf java.util.NoSuchElementException: None.get at scala.None$.get(Option.scala:529) at scala.None$.get(Option.scala:527) at $0caeab65743649cd767c$.$anonfun$$sbtdef$1(/openEQUELLA-2022.2.0/build.sbt:133) at scala.Function1.$anonfun$compose$1(Function1.scala:49) at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:228) at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:170) at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:87) at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:99) at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:94) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) [error] java.util.NoSuchElementException: None.get [error] Use 'last' for the full log. [warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)

Thanks for your time and attention!

edalex-ian commented 1 year ago

Hey @averyirin

Thanks for the detailed run through. I'll have a closer look for you. In the meantime, don't forget you can always use the CI build for reference as it also essentially sets up a docker image and then builds in it.

https://github.com/openequella/openEQUELLA/blob/develop/.github/workflows/ci.yaml

edalex-ian commented 1 year ago

I've figured out the issue you're encountering @averyirin . It's due to attempting to build from a download of the release source rather than from a git clone.

The error you thought was related to application.conf was actually pointing to line 133 of build.conf: https://github.com/openequella/openEQUELLA/blob/2022.2.0/build.sbt#L133

You can see on this line the build is attempting to determine the git hash to include in the build version. You have two options:

  1. (Recommended) Build from a clone and simply checkout the tag for the version you want; or
  2. (Not recommended) Stick with the source archive method, but modify build.sbt so that lines 133-135 are simply replaced with val shortCommit = "g1234567" (or a string of your liking) - but this could mess with things when upgrading etc.

Let us know how you get on.

(BTW. You're docker setup is correct - I validated it - you just need to address the above. Be aware there is an - unmaintained - Dockerfile for a build image at https://github.com/openequella/openEQUELLA/blob/develop/docker/docker-build/Dockerfile)

saiKapilBunni-zessta commented 1 year ago

fixed : able to build installer