Java – eclipse can have multiple output folders like multiple source folders

I have an eclipse project that has two source folders – 'SRC' and 'test' I want to build from these two folders into a separate output folder

The reason is that both folders have a folder called serviceproviders Properties, which has different values for code production and test run

The problem is that because all compiled classes in only one output folder are copied, the property file in 'test' will not be copied. As a result, my test code obtained the production version of the property file I think I'm trying to simulate that we can have different Classpaths (and their search order) in Maven

If this doesn't work, I'll use JVM properties to specify some values I can use in test cases However, it does not seem to be an elegant solution

Using Maven will make this work, but I can't use Maven in this project

Update 1:

Thanks for the two answers Since they are the same, I have accepted the previous release

Upadte 2:

Even though I can get multiple output folders of the corresponding source folder, it does not solve my original problem, that is, loading service providers from the test when I run the test case Properties, and when the application is running on the server, the serviceproviders are loaded from Src Properties Eclispe I work by creating a separate jar file from the test folder with serviceproviders Properties file In the run configuration of my test case, I add this jar file and change the order, so it appears as the first dependency found

Solution

Yes, I just checked If you enter the properties of the project and then enter the Java build path, you can select different source folders. There is also an option called "allow output folders of source folders". If you select Add editable output folders for each source folder Just select it and click the Edit button

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>