Adding a repository for setup

Tags: #<Tag:0x00007f751b3c7660>

I have a module and a distro called “mirebalais.” I recently added the repository for Mekom to it –

<repository>  <!-- Mekom repository, for Initializer -->                
    <id>mks-nexus-public</id>                                           
    <url>https://nexus.mekomsolutions.net/repository/maven-public/</url>
    <snapshots>                                                         
        <updatePolicy>always</updatePolicy>                             
    </snapshots>                                                        
</repository>                                                           

now appears in the top-level pom.xml for openmrs-module-mirebalais. It works fine when installing, building, and running an existing server.

However, when I try to create a new server using

mvn openmrs-sdk:setup -DserverId=my-server -Ddistro=org.openmrs.module:mirebalais:1.2-SNAPSHOT -DdbUri=jdbc:mysql://localhost:3306/" my_server             

I get

[ERROR] Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:3.13.2:setup (default-cli) on project standalone-pom: Failed to setup server: Unable to execute mojo: Unable to find artifact. Failure to find org.openmrs.module:initializer-omod:jar:1.1.0 in http://mavenrepo.openmrs.org/nexus/content/repositories/public was cached in the local repository, resolution will not be reattempted until the update interval of archetype has elapsed or updates are forced
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR]     mvn install:install-file -DgroupId=org.openmrs.module -DartifactId=initializer-omod -Dversion=1.1.0 -Dpackaging=jar -Dfile=/path/to/file                                                    
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR]     mvn deploy:deploy-file -DgroupId=org.openmrs.module -DartifactId=initializer-omod -Dversion=1.1.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]                      
[ERROR]
[ERROR]
[ERROR]   org.openmrs.module:initializer-omod:jar:1.1.0
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR]   archetype (http://mavenrepo.openmrs.org/nexus/content/repositories/public, releases=true, snapshots=true),
[ERROR]   openmrs-repo (http://mavenrepo.openmrs.org/nexus/content/repositories/public, releases=true, snapshots=true),
[ERROR]   openmrs-repo-thirdparty (http://mavenrepo.openmrs.org/nexus/content/repositories/thirdparty, releases=true, snapshots=true),                                                                  
[ERROR]   openmrs-bintray-repo (https://dl.bintray.com/openmrs/maven/, releases=true, snapshots=true),
[ERROR]   central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)
[ERROR] -> [Help 1]

One thing I notice about this error log is that the list of repositories, besides not including the Mekom repo, includes repositories not listed in the mirebalais POM, such as openmrs-bintray-repo.

How can one add a repository that will be used during openmrs-sdk:setup?

@mksd @mogoodrich

Hi @bistenes,

From the top of my head sdk:setup only relies on the openmrs-server.properties and runs locally without needing other Maven repositories than the local one. Could you confirm that?

I got it figured out, following a pointer from @mseaton. openmrs-sdk:setup uses the repos configured in .m2/settings.xml. I had just had to add the Mekom repo to that list.