OpenLiberty / ci.gradle

Gradle plugins for managing Liberty profile servers #devops
Apache License 2.0
48 stars 51 forks source link

How do I server static files using the Liberty plugin? #873

Closed paulbarr closed 9 months ago

paulbarr commented 9 months ago

I am running the liberty plugin and my application is working However, I can not server any of the static files that I usually serve

When I start the plugin in it creates the liberty instance using loose config So in my apps directory I have a file called 'lands_advisor.war.xml'

This list all my classes and has file references to the files in my lib directory So it looks like this....

<?xml version="1.0" encoding="UTF-8"?>
<archive>
    <dir sourceOnDisk="/CODE/lands_advisor/build/classes/java/main" targetInArchive="/WEB-INF/classes/"/>
    <dir sourceOnDisk="/CODE/lands_advisor/build/resources/main" targetInArchive="/WEB-INF/classes/"/>

If I modify this file to point to a specific location using file or dir it gets removed when I start the plugin Where are static files served from in a loose config? How can I specify a locaiton that the plugin does not overwrite?

Thanks

paulbarr commented 9 months ago

So once I turned off LooseConfig everything started working as expected I added this to my build.gradle

liberty {
     server {
        serverXmlFile = file('server.xml')
        looseApplication=false
    }
}

I'll close this issue

paulbarr commented 9 months ago

However, once I turned off loose config I lost hot deploy I fixed this in the end by just adding an empty folder as follows: /src/main/webapp Once I added that the paths all get setup and everything works