سؤال

Is it possible to retrieve the number of available processors in maven in a platform-independent way? I'd like to be able to activate a profile if available_processors > 1.

هل كانت مفيدة؟

المحلول

There's no easy way to do that. You'd have to write a Maven extension that stores the result of Runtime.availableProcessors() in a System Property. You'd have to put that extension in $Maven_HOME/lib/ext (see MNG-4984). Writing a Maven Plugin is not enough, Plugin resolution happens after profile activation. I don't think it would be possible to write a custom ProfileActivator, mainly because the pom.xml XSD won't allow it.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top