问题
Is anyone aware of a maven plugin, ant task, or gradle plugin which can verify that an rpm has already been installed on a Linux system? All the plugins coming up in google results seem to be focused on creating RPMs rather than checking for RPM dependencies e.g.
- c-builds plugin http://mojo.codehaus.org/cbuild-parent/
- rpm-maven-plugin http://mojo.codehaus.org/rpm-maven-plugin/index.html
Context: we have some maven-native-plugin artifacts which depend on the /usr/include/openssl/ssl.h and /usr/lib/libssl.a from the openssl-devel RPM. I'd like a way to verify that the openssl-devel RPM has been installed.
My question is kind of similar to Is there a Maven plugin to fetch an rpm. But I'm okay if the plugin just confirms that an RPM is installed on a Red Hat Linux system, actually fetching the RPM would just be a nice to have.
回答1:
You can write a small maven enforcer rule that just calls Runtime.getRuntime().exec("rpm -q openssl-devel") and parse the output. It's simple and fast. If you don't find the rpm the enforcer can break the build and give you a heads up.
- http://maven.apache.org/enforcer/maven-enforcer-plugin/
- http://maven.apache.org/enforcer/enforcer-api/writing-a-custom-rule.html
来源:https://stackoverflow.com/questions/23476684/maven-plugin-ant-task-or-gradle-plugin-which-checks-that-rpm-has-been-installe