我是Maven和RPM制作的新手。
我已经能够成功构建WAR,将其打包并安装它。
要构建rpm,请使用以下命令:
mvn install rpm:rpm
这将构建WAR文件,将其安装到我的本地存储库并生成RPM文件。
我的问题是:
我是否违反了我配置rpm-maven-plugin的规范或标准?
我的pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>myGroupId</groupId>
<artifactId>myapp</artifactId>
<version>1.1.0</version>
<packaging>war</packaging>
<name>My App</name>
...
<build>
<sourceDirectory>${basedir}/src</sourceDirectory>
<scriptSourceDirectory>${basedir}/src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>
<resources>
<resource>
<directory>${basedir}/src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<directory>${basedir}/src/test/resources</directory>
</testResource>
</testResources>
<directory>${basedir}/target</directory>
<finalName>myapp</finalName>
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1.5</version>
<configuration>
<defineStatements>
<defineStatement>_project myproject</defineStatement>
<defineStatement>_tomcat_root ${TOMCAT_ROOT}</defineStatement>
</defineStatements>
<copyright>myCopyright</copyright>
<distribution>myApp</distribution>
<group>Applications/System</group>
<description>
My description
</description>
<defaultDirmode>755</defaultDirmode>
<defaultFilemode>644</defaultFilemode>
<defaultGroupname>myapp</defaultGroupname>
<defaultUsername>myapp</defaultUsername>
<mappings>
<mapping>
<directory>%{_tomcat_root}/webapps</directory>
<configuration>true</configuration>
<sources>
<source>
<location>../MyApp/config</location>
</source>
</sources>
</mapping>
<mapping>
<directory>%{_tomcat_root}/webapps</directory>
<artifact>
<classifiers>
<classifier/>
</classifiers>
</artifact>
</mapping>
</mappings>
<preinstallScriptlet>
<script>
echo "Installing to Tomcat Root Directory: %{_tomcat_root}"
echo "stopping tomcat6"
/etc/init.d/tomcat6 stop
</script>
</preinstallScriptlet>
<postinstallScriptlet>
<script>
echo "Running postinstallScriptlet - script"
echo "starting tomcat6"
/etc/init.d/tomcat6 start
</script>
</postinstallScriptlet>
</configuration>
</plugin>
</plugins>
</build>
</project>