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

PAYARA-1618 outputuberjar packages up applications deployed to rootdir #1705

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2016-2017 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -40,6 +40,7 @@
package fish.payara.micro.impl;

import com.google.common.io.Files;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
Expand All @@ -58,6 +59,8 @@
import java.util.jar.JarOutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.CRC32;
import java.util.zip.CheckedInputStream;

/**
*
Expand Down Expand Up @@ -338,6 +341,27 @@ public void buildUberJar() {
}

}

File applicationsDir = new File(domainDir, "applications");
if (applicationsDir.exists()){
for (File app : fillFiles(applicationsDir)){
String path = app.getPath();
if (path.endsWith(".war") || path.endsWith(".jar") || path.endsWith(".rar") || path.endsWith(".ear")){
JarEntry appEntry = new JarEntry("MICRO-INF/deploy/" + app.getName());
appEntry.setSize(app.length());
CheckedInputStream check = new CheckedInputStream(new FileInputStream(app), new CRC32());
BufferedInputStream in = new BufferedInputStream(check);
while (in.read(new byte[300]) != -1){
//read in file completly
}
appEntry.setCrc(check.getChecksum().getValue());
jos.putNextEntry(appEntry);
Files.copy(app, jos);
jos.flush();
jos.closeEntry();
}
}
}
}
LOGGER.info("Built Uber Jar " + outputFile.getAbsolutePath() + " in " + (System.currentTimeMillis() - start) + " (ms)");

Expand Down