Excluding source files even if they are referenced

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Excluding source files even if they are referenced

Alex Gerdov

Hello,

I was wondering - is it possible to instruct the compiler plug-in to exclude source files even if they are referenced directly by other source files?

Thank you.

 

Alex Gerdov
Research & Development

(t+972-54-6489120
(e) [hidden email]
(w) www.unboundtech.com
 

This email message and any attachments thereto are confidential and/or subject to privacy laws and/or non-disclosure agreements and are intended only for use by the addressee(s) named above. The writer asserts in respect of this message and attachments all rights for confidentiality or privacy to the fullest extent permitted by law.

Reply | Threaded
Open this post in threaded view
|

Re: Excluding source files even if they are referenced

Thomas Broyer-2
On Mon, Sep 14, 2020 at 1:41 PM Alex Gerdov <[hidden email]>
wrote:

> Hello,
>
> I was wondering - is it possible to instruct the compiler plug-in to
> exclude source files even if they are referenced directly by other source
> files?
>

It depends what you're trying to do.
You can exclude [1] those files, but then because the maven-compiler-plugin
sets the sourcepath to your source roots, the files will be compiled anyway
if they are referenced by others that are being compiled [2].
You could use -implicit:none in compilerArgs to prevent the corresponding
*.class file from being generated though. So compilation will succeed, but
the output will be "incomplete" (but maybe that's what you want after all).

[1]
https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#excludes
[2] https://blog.ltgt.net/most-build-tools-misuse-javac/

--
Thomas Broyer
/tɔ.ma.bʁwa.je/ <http://xn--nna.ma.xn--bwa-xxb.je/>