Spring 启动 Maven rpm

use*_*065 5 rpm maven spring-boot

我有一个弹簧启动应用程序。今天maven从项目中创建了jar。下面是我的 pom.xml 的构建部分

<build>
    <finalName>xsmartadapter</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>${java-version}</source>
                <target>${java-version}</target>
                <compilerArgument>-Xlint:all</compilerArgument>
                <showWarnings>true</showWarnings>
                <showDeprecation>true</showDeprecation>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

通过在上面的构建部分添加以下内容,我可以生成 rpm。

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>rpm-maven-plugin</artifactId>
  <version>2.1.5</version>
  <extensions>true</extensions>
  <executions>
      <execution>
          <id>generate-rpm</id>
              <goals>
                  <goal>rpm</goal>
              </goals>
          <phase>prepare-package</phase>
      </execution>
  </executions>
    <configuration>
      <group>Application</group>
      <packager>SWWDC</packager>
      <mappings>
          <mapping>
              <directory>${basedir}/target</directory>
              <sources>
                  <source>
                      <location>target/classes</location>
                  </source>
              </sources>
          </mapping>
      </mappings>
      <name>xsmartadapter</name>
      <executable>rpmbuild</executable>
      <workingDirectory>${basedir}</workingDirectory>
  </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

但是当我尝试安装并启动服务时sudo service 'name' start。说找不到服务。

但是当我创建一个tar.gz文件并生成一个rpmusing 时,rpmbuild -ba target/filename.spec我就可以启动该服务。

我的目标是生成一个rpm(来自 maven),安装它并启动服务。

请提供一些建议。