Configure package repositories

2024/1/21 |

This article describes how to configure packages repositories on CLEAR Engine.

In this article, you will learn how to:

  • Configure packages repositories for Gradle, Maven, and MSBuild on CLEAR Engine.

At the end, you will be able to configure packages repositories on CLEAR Engine.

Configure packages repository locations

When building .NET and Java applications, build tools such Maven and MSBuild might download packages required to build these applications. As these build tools are run by a service account, these packages are downloaded to directories under the profile directory of the service account such as C:\Windows\ServiceProfiles\NetworkService or C:\Windows\SysWOW64\config\systemprofile. To change where build tools save downloaded packages, follow these steps:

  1. Open Windows PowerShell as administrator.
  2. Enter the following command:

     # Replace C:\ProgramData\Lucent Sky\CLEAR Engine if using a custom file system storage location
     $fileSystemStorage = "C:\ProgramData\Lucent Sky\CLEAR Engine"
     $gradleUserHome = "$fileSystemStorage\.gradle"
     $nugetPackages = "$fileSystemStorage\.nuget\packages"
     [System.Environment]::SetEnvironmentVariable('GRADLE_USER_HOME', "$gradleUserHome", [System.EnvironmentVariableTarget]::Machine)
     [System.Environment]::SetEnvironmentVariable('NUGET_PACKAGES', "$nugetPackages", ,[System.EnvironmentVariableTarget]::Machine)
     Stop-Service "CLEAR Engine"; Start-Service "CLEAR Engine"
    
  3. In Windows PowerShell, enter the following command to open Apache Maven's settings file with a text editor:

     Invoke-Item "C:\Program Files\Lucent Sky\CLEAR Engine\Tools\apache-maven-*\conf\settings.xml"`
    
  4. In settings.xml, locate and uncomment the <localRepository>` tag, and set its value to the location for Maven to save downloaded packages, such as C:\ProgramData\Lucent Sky\CLEAR Engine\.m2\repository.

  5. In Windows PowerShell, enter the following command to open sbt's config file with a text editor:

     `Invoke-Item "C:\Program Files\Lucent Sky\CLEAR Engine\Tools\sbt-*\conf\sbtconfig.txt"`
    
  6. Add the following to the end of sbtconfig.txt:

     # Replace C:\ProgramData\Lucent Sky\CLEAR Engine in the following lines if using a custom file system storage location
     -Dsbt.boot.directory="C:\ProgramData\Lucent Sky\CLEAR Engine\.sbt\boot"
     -Dsbt.global.base="C:\ProgramData\Lucent Sky\CLEAR Engine\.sbt"
     -Dsbt.ivy.home="C:\ProgramData\Lucent Sky\CLEAR Engine\.ivy2"
     -Dsbt.repository.config="C:\ProgramData\Lucent Sky\CLEAR Engine\.sbt\repositories"
    

Configure remote package repositories

Starting with Lucent Sky AVM version 2112, the included Apache Maven no longer supports custom repositories using HTTP. Therefore, if a project has dependencies from custom repositories using HTTP, the Maven build will fail. This can verified by the presence of maven-default-http-blocker (http://0.0.0.0/) in the Maven logs.

It is recommended to migrate these custom repositories to HTTPS. If not possible, follow these steps to enable custom repositories using HTTP:

  1. Open Windows PowerShell as administrator.
  2. Enter the following command to open Apache Maven's settings file with a text editor:

     Invoke-Item "C:\Program Files\Lucent Sky\CLEAR Engine\Tools\apache-maven-*\conf\settings.xml"`
    
  3. In settings.xml, locate a <mirror> tag with a <id>maven-default-http-blocker</id> tag. Comment this <mirror> tag to disable it.