Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for war plugin webResources #767

Closed
NottyCode opened this issue Apr 3, 2020 · 6 comments
Closed

Add support for war plugin webResources #767

NottyCode opened this issue Apr 3, 2020 · 6 comments
Assignees
Labels

Comments

@NottyCode
Copy link
Member

I've been experimenting with using dev mode with the Open Liberty website. The Open Liberty website build is a little convoluted because the web content is built with jekyll and the jekyll build runs prior to the maven build and writes the content into a separate directory.

The maven build uses the war packager which has some configuration to pick up the web resources from additional locations and it is pointed at the output of the jekyll build. This configuration is ignored by the dev mode. The configuration is this:

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
	<failOnMissingWebXml>false</failOnMissingWebXml>
	<warName>openliberty</warName>
	<webResources>
		<resource>
			<!-- this is relative to the pom.xml directory -->
			<directory>target/jekyll-webapp</directory>
		</resource>
	</webResources>
</configuration>

the generated app config looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<archive>
    <dir sourceOnDisk="/Users/nottinga/Documents/github/open-liberty-website/openliberty.io/src/main/webapp" targetInArchive="/"/>
    <dir sourceOnDisk="/Users/nottinga/Documents/github/open-liberty-website/openliberty.io/target/classes" targetInArchive="/WEB-INF/classes"/>
    <file sourceOnDisk="/Users/nottinga/Documents/github/open-liberty-website/openliberty.io/target/tmp/META-INF/MANIFEST.MF" targetInArchive="/META-INF/MANIFEST.MF"/>
</archive>

which means it doesn't contain the generated content. This isn't a massive problem if all I'm doing is changing the JAX-RS backend, but it is a problem when looking at the front end and backend.

The website github project is here: https://github.com/openliberty/openliberty.io

@turkeylurkey
Copy link
Member

The app config file will be:

<?xml version="1.0" encoding="UTF-8"?>
<archive>
    <dir sourceOnDisk="/Users/paulg/WAS/devExperience/issues/ci.maven-767/openliberty.io/src/main/webapp" targetInArchive="/"/>
    <dir sourceOnDisk="/Users/paulg/WAS/devExperience/issues/ci.maven-767/openliberty.io/target/classes" targetInArchive="/WEB-INF/classes"/>
    <dir sourceOnDisk="/Users/paulg/WAS/devExperience/issues/ci.maven-767/openliberty.io/target/jekyll-webapp" targetInArchive="/"/>
    <file sourceOnDisk="/Users/paulg/.m2/repository/javax/json/javax.json-api/1.0/javax.json-api-1.0.jar" targetInArchive="/WEB-INF/lib/javax.json-api-1.0.jar"/>
    <file sourceOnDisk="/Users/paulg/.m2/repository/javax/enterprise/cdi-api/1.2/cdi-api-1.2.jar" targetInArchive="/WEB-INF/lib/cdi-api-1.2.jar"/>
    <file sourceOnDisk="/Users/paulg/.m2/repository/javax/el/javax.el-api/3.0.0/javax.el-api-3.0.0.jar" targetInArchive="/WEB-INF/lib/javax.el-api-3.0.0.jar"/>
    <file sourceOnDisk="/Users/paulg/.m2/repository/javax/interceptor/javax.interceptor-api/1.2/javax.interceptor-api-1.2.jar" targetInArchive="/WEB-INF/lib/javax.interceptor-api-1.2.jar"/>
    <file sourceOnDisk="/Users/paulg/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar" targetInArchive="/WEB-INF/lib/javax.inject-1.jar"/>
    <file sourceOnDisk="/Users/paulg/WAS/devExperience/issues/ci.maven-767/openliberty.io/target/tmp/META-INF/MANIFEST.MF" targetInArchive="/META-INF/MANIFEST.MF"/>
</archive>

@turkeylurkey
Copy link
Member

turkeylurkey commented Apr 13, 2020

Without the line <dir sourceOnDisk="/Users/paulg/WAS/devExperience/issues/ci.maven-767/openliberty.io/target/jekyll-webapp" targetInArchive="/"/> the app prints (Status 404):

Error Page Exception
SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.

Original Exception:
Error Message: SRVE0190E: File not found: /
Error Code: 404
Target Servlet:
Error Stack:
com.ibm.ws.webcontainer.webapp.WebAppErrorReport: SRVE0190E: File not found: /
     at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendError(WebAppDispatcherContext.java:637)
     at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendError(WebAppDispatcherContext.java:655)
     at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendError(SRTServletResponse.java:1334)
     at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:824)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:182)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:93)
     at io.openliberty.website.TLSFilter.doFilter(TLSFilter.java:64)
...

With that line, Status 200 and:
Docs Get Started Support Fork the code ....

@turkeylurkey
Copy link
Member

It took a little work to get the site working locally but the layout was incorrect. Since the server found the web resources I'll close this issue.

@andre-doherty
Copy link

Thanks a lot for the fix. I was able to test it successfully on my side as well.

@turkeylurkey : Would you know when the next release of the plugin is expected ?

@cherylking
Copy link
Member

@andre-doherty We are actually working on getting a release out by the end of this month.

@andre-doherty
Copy link

@cherylking That sounds great. Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

5 participants