0

I need to specify reportDirectory so that it's in a different local drive compared to where the project is located. Another words, my project is somewhere in C:/ and I need to generate some artifacts after build in shared folder or another local drive which is mapping that shared folder

<configuration>
                <reportDirectory>G:/someFolder</reportDirectory>
</configuration>

or

<configuration>
                <reportDirectory>\\PCNAME1234/someFolder</reportDirectory>
</configuration>

When I try those variants I get

java.lang.IllegalArgumentException: 'other' has different root

and

IllegalArgumentException: 'other' is different type of Path

accordingly. The build fails even though report is generated.

Is there a possible way to implement this without build failure?

Oleg
  • 1
  • 2
  • You can generate everything in the project and copy the necessary artifacts afterwards: https://stackoverflow.com/questions/7063475/maven-how-to-copy-artifact-to-specific-directory – Conffusion Sep 17 '20 at 07:59
  • generated report is just a folder with some jsons and subfolders in it, not an artifacts. so I don't think I can use this method – Oleg Sep 17 '20 at 08:49
  • 1
    Writing to folders outside the project directory during the build is not recommended. This way, your build cannot be run on other computers or the build server. – J Fabian Meier Sep 17 '20 at 09:06
  • I'm doing it for build server specifically so it's the only machine where I want this action to be performed. I know it's not a good practice but I need to implement it anyway This files should be written after build's completed so I don't expect anything to go wrong – Oleg Sep 17 '20 at 09:13
  • In particular if you run on a CI server never write something outside the project directories cause that will break/influence other jobs etc. Apart from that using CI solution s offer appropriate setup's to collect the appropriate reports or usually better solution that implementing them yourself. The question what kind of reports ? – khmarbaise Sep 17 '20 at 09:57
  • I'm dealing with Allure report. I know there is plugin for CI solutions like Jenkins which we use but for some reason I cannot use it so I need a workaround for actions that described in this topic. Like I said I know it's not a best practice, but I want to find a solution anyway – Oleg Sep 17 '20 at 10:39
  • @Oleg You usually do not get help on Stackoverflow if you do not explain why you need to do this. Especially if it is against good practise. – J Fabian Meier Sep 17 '20 at 14:54
  • @JFabianMeier I need to implement this solution because I cannot use Jenkins plugin on CI server due to some working policies and other non-technical reasons. So I have to find a workaround, all other things already have been made but I still need to store reports in remote server where Jenkins job are running to be able to open them remotely. I need to keep reports in shared folder since there are 3 remote machines that randomly picked by Jenkins to run job on them and in order to synchronize all generated reports I have to put them to shared folder – Oleg Sep 18 '20 at 07:14

0 Answers0