Continuous testing failure

130 views
Skip to first unread message

Den

unread,
Sep 1, 2021, 4:09:28 AM9/1/21
to Quarkus Development mailing list
Hi,

I have a test which needs to read all files from src/main/resources and the test works fine with mvn test. Continuous testing however fails:

java.nio.file.NoSuchFileException: src/main/resources
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:439)
    at java.base/java.nio.file.Files.newDirectoryStream(Files.java:476)
    at java.base/java.nio.file.Files.list(Files.java:3765)

Is it a bug or is there any setting to make src/main/resource available?

Thanks!

Stuart Douglas

unread,
Sep 1, 2021, 4:13:38 AM9/1/21
to denni...@gmail.com, Quarkus Development mailing list
It's because Quarkus dev mode is started from the target directory, so it would need to look for ../src/main/resources.

DevMojo does have a 'workingDir' attribute, so you could try setting <workingDir>${project.directory}</workingDir> and see if that helps. Or you can use ClassLoader.getResource() to access the files.

Stuart

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/615d96f6-82a8-4996-9688-a0be0396b61cn%40googlegroups.com.

Den

unread,
Sep 1, 2021, 6:43:07 AM9/1/21
to Quarkus Development mailing list
Tried,             
  <groupId>${quarkus.platform.group-id}</groupId>
                <artifactId>quarkus-maven-plugin</artifactId>
                <version>${quarkus.platform.version}</version>
                <configuration>
                    <workingDir>${project.directory}</workingDir>
                </configuration>

didn't help. It seems, that quarkus is still starting from the target dir. System property 'user.dir' is 'target'.

Why is the working dir not the project dir like in maven by default?

Stuart Douglas

unread,
Sep 1, 2021, 7:46:07 AM9/1/21
to denni...@gmail.com, Quarkus Development mailing list


On Wed, 1 Sep 2021, 8:43 pm Den, <denni...@gmail.com> wrote:
Tried,             
  <groupId>${quarkus.platform.group-id}</groupId>
                <artifactId>quarkus-maven-plugin</artifactId>
                <version>${quarkus.platform.version}</version>
                <configuration>
                    <workingDir>${project.directory}</workingDir>
                </configuration>

didn't help. It seems, that quarkus is still starting from the target dir. System property 'user.dir' is 'target'.

Why is the working dir not the project dir like in maven by default?

Because up until we had continuous testing it didn't really matter :-)

I think we should look at changing the default. Technically it's a breaking change but I don't think it will really affect anyone, and we can add an option to make it backwards compatible.

That said I think that configuration should work, so I need to look into what is going on.

Stuart


sdou...@redhat.com schrieb am Mittwoch, 1. September 2021 um 10:13:38 UTC+2:
It's because Quarkus dev mode is started from the target directory, so it would need to look for ../src/main/resources.

DevMojo does have a 'workingDir' attribute, so you could try setting <workingDir>${project.directory}</workingDir> and see if that helps. Or you can use ClassLoader.getResource() to access the files.

Stuart

On Wed, 1 Sept 2021 at 18:09, Den <denni...@gmail.com> wrote:
Hi,

I have a test which needs to read all files from src/main/resources and the test works fine with mvn test. Continuous testing however fails:

java.nio.file.NoSuchFileException: src/main/resources
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:439)
    at java.base/java.nio.file.Files.newDirectoryStream(Files.java:476)
    at java.base/java.nio.file.Files.list(Files.java:3765)

Is it a bug or is there any setting to make src/main/resource available?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/615d96f6-82a8-4996-9688-a0be0396b61cn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.

Den

unread,
Sep 1, 2021, 8:02:43 AM9/1/21
to Quarkus Development mailing list
+1 for making working dir the same as project dir! it also great for files that are not in the resources folder.

Thanks!

Stuart Douglas

unread,
Sep 1, 2021, 9:45:10 PM9/1/21
to denni...@gmail.com, Quarkus Development mailing list
Reply all
Reply to author
Forward
0 new messages