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

Exception when directory doesn't exist with quarkus-maven-plugin #5680

Closed
Arcnor opened this issue Nov 22, 2019 · 4 comments · Fixed by #5684
Closed

Exception when directory doesn't exist with quarkus-maven-plugin #5680

Arcnor opened this issue Nov 22, 2019 · 4 comments · Fixed by #5684
Assignees
Labels
area/build kind/bug Something isn't working
Milestone

Comments

@Arcnor
Copy link

Arcnor commented Nov 22, 2019

Describe the bug
The quarkus-maven-plugin fails with an exception if it's configured with a finalName using a directory that doesn't exist. I think this was working in previous versions, so looks like a regression.

To Reproduce

In your pom.xml

...
<plugin>
				<groupId>io.quarkus</groupId>
				<artifactId>quarkus-maven-plugin</artifactId>
				<version>1.0.0.CR2</version>
				<executions>
					<execution>
						<goals>
							<goal>build</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<finalName>${project.build.directory}/non-existing-dir/${project.build.finalName}</finalName>
				</configuration>
			</plugin>
...

Then mvn clean package will fail with an exception like this one:

[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.0.0.CR2:build (default) on project server-quarkus: Failed to build a runnable JAR: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR]     [error]: Build step io.quarkus.deployment.pkg.steps.JarResultBuildStep#buildRunnerJar threw an exception: java.lang.IllegalStateException: java.io.IOException: Failed to create a new filesystem for jar:file:/tmp/test/target/non-existing-dir/server-quarkus-1.0-SNAPSHOT-runner.jar
[ERROR]     at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:950)
[ERROR]     at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
[ERROR]     at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
[ERROR]     at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR]     at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.io.IOException: Failed to create a new filesystem for jar:file:/tmp/test/target/non-existing-dir/server-quarkus-1.0-SNAPSHOT-runner.jar
[ERROR]     at io.quarkus.bootstrap.util.ZipUtils.newFileSystem(ZipUtils.java:150)
[ERROR]     at io.quarkus.bootstrap.util.ZipUtils.newZip(ZipUtils.java:102)
[ERROR]     at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildThinJar(JarResultBuildStep.java:295)
[ERROR]     at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildRunnerJar(JarResultBuildStep.java:141)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR]     at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:941)
[ERROR]     ... 7 more
[ERROR] Caused by: java.nio.file.NoSuchFileException: /tmp/test/target/non-existing-dir/server-quarkus-1.0-SNAPSHOT-runner.jar
[ERROR]     at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
[ERROR]     at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
[ERROR]     at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
[ERROR]     at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
[ERROR]     at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:478)
[ERROR]     at java.base/java.nio.file.Files.newOutputStream(Files.java:219)
[ERROR]     at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:112)
[ERROR]     at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:109)
[ERROR]     at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:337)
[ERROR]     at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:286)
[ERROR]     at io.quarkus.bootstrap.util.ZipUtils.newFileSystem(ZipUtils.java:143)
[ERROR]     ... 15 more
[ERROR] -> [Help 1]
[ERROR]
@Arcnor Arcnor added the kind/bug Something isn't working label Nov 22, 2019
@gsmet gsmet added the good first issue Good for newcomers label Nov 22, 2019
@jaikiran
Copy link
Member

@gsmet, I can take a look at this, if that's OK.

@Arcnor
Copy link
Author

Arcnor commented Nov 22, 2019

More info, even after creating the directory manually, looks like the jar fails to work and I get an exception stating that Caused by: java.lang.ClassNotFoundException: io.quarkus.runtime.Application.

When removing the finalName from the config, the generated JAR works properly.

UPDATE: This looks like it's a misunderstanding on my part, the generated jar is not a fat jar and somehow loads other jars in the lib directory even when not passing them to the classpath, so this is unrelated to this issue

@gsmet
Copy link
Member

gsmet commented Nov 22, 2019

@jaikiran sure, I affected it to you.

@jaikiran
Copy link
Member

PR with a fix for the NoSuchFileException #5684

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants