List of usage examples for org.springframework.boot.loader.tools DefaultLaunchScript DefaultLaunchScript
public DefaultLaunchScript(File file, Map<?, ?> properties) throws IOException
From source file:org.springframework.boot.gradle.tasks.bundling.AbstractBootArchiveTests.java
@Test public void launchScriptCanBePrepended() throws IOException { this.task.setMainClassName("com.example.Main"); this.task.launchScript(); this.task.execute(); Map<String, String> properties = new HashMap<>(); properties.put("initInfoProvides", this.task.getBaseName()); properties.put("initInfoShortDescription", this.project.getDescription()); properties.put("initInfoDescription", this.project.getDescription()); assertThat(Files.readAllBytes(this.task.getArchivePath().toPath())) .startsWith(new DefaultLaunchScript(null, properties).toByteArray()); try {//from w w w . ja va 2 s. co m Set<PosixFilePermission> permissions = Files .getPosixFilePermissions(this.task.getArchivePath().toPath()); assertThat(permissions).contains(PosixFilePermission.OWNER_EXECUTE); } catch (UnsupportedOperationException ex) { // Windows, presumably. Continue } }
From source file:org.springframework.boot.gradle.tasks.bundling.BootZipCopyAction.java
private void writeLaunchScriptIfNecessary(FileOutputStream fileStream) { try {/*w w w. j a v a2 s. c o m*/ if (this.launchScript != null) { fileStream.write( new DefaultLaunchScript(this.launchScript.getScript(), this.launchScript.getProperties()) .toByteArray()); this.output.setExecutable(true); } } catch (IOException ex) { throw new GradleException("Failed to write launch script to " + this.output, ex); } }