Maven install plugin错误地安装了几个deb包

0ejtzxu1  于 2023-08-03  发布在  Maven
关注(0)|答案(1)|浏览(93)

我对maven-install-plugin和.deb包有问题。maven-install-plugin错误地安装.deb包并覆盖生成的.deb包两次。

[INFO] --- maven-install-plugin:3.0.1:install (default-install) @ project ---
[INFO] Installing /home/me/project/pom.xml to /home/me/.m2/repository/my/test/project/1.4.0/project-1.4.0.pom
[INFO] Installing /home/me/project/target/project-1.4.0.jar to /home/me/.m2/repository/my/test/project/1.4.0/project-1.4.0.jar
[INFO] Installing /home/me/project/target/liblinuxjava-1.4.0_all.deb to /home/me/.m2/repository/my/test/project/1.4.0/project-1.4.0.deb
[INFO] Installing /home/me/project/target/libwinjava-1.4.0_all.deb to /home/me/.m2/repository/my/test/project/1.4.0/project-1.4.0.deb
[INFO] Installing /home/me/project/target/project-1.4.0-javadoc.jar to /home/me/.m2/repository/my/test/project/1.4.0/project-1.4.0-javadoc.jar
[INFO] ------------------------------------------------------------------------

字符串
我的项目中有这个.pom文件。

<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>my.test</groupId>
    <artifactId>project</artifactId>
    <version>1.4.0</version>
    <packaging>jar</packaging>

    <properties>
        <!-- Project properties -->
        <maven.compiler.source>6</maven.compiler.source>
        <maven.compiler.target>6</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <!-- Build dependencies -->
        <version.jdeb>1.8</version.jdeb>
        <version.maven-javadoc>3.2.0</version.maven-javadoc>
        <version.maven-jar>3.3.0</version.maven-jar>
        <version.maven-install>3.0.1</version.maven-install>
    </properties>

    <profiles>
        <!-- Release -->
        <profile>
            <id>release</id>
            <activation>
                <os>
                    <family>linux</family>
                </os>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <artifactId>jdeb</artifactId>
                        <groupId>org.vafer</groupId>
                        <version>${version.jdeb}</version>
                        <executions>
                            <execution>
                                <id>liblinuxjava</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jdeb</goal>
                                </goals>
                                <configuration>
                                    <deb>${project.basedir}/target/liblinuxjava-${project.version}_all.deb</deb>
                                    <controlDir>${project.basedir}/deb/liblinuxjava/control</controlDir>
                                    <dataSet>
                                        <data>
                                            <src>${project.basedir}/deb/liblinuxjava/data/</src>
                                            <type>directory</type>
                                            <mapper>
                                                <type>perm</type>
                                                <prefix>/</prefix>
                                            </mapper>
                                        </data>
                                    </dataSet>
                                </configuration>
                            </execution>
                            <execution>
                                <id>libwinjava</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jdeb</goal>
                                </goals>
                                <configuration>
                                    <deb>${project.basedir}/target/libwinjava-${project.version}_all.deb</deb>
                                    <controlDir>${project.basedir}/deb/libwinjava/control</controlDir>
                                    <dataSet>
                                        <data>
                                            <src>${project.basedir}/deb/libwinjava/data/</src>
                                            <type>directory</type>
                                            <mapper>
                                                <type>perm</type>
                                                <prefix>/</prefix>
                                            </mapper>
                                        </data>
                                    </dataSet>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${version.maven-javadoc}</version>
                        <executions>
                            <execution>
                                <id>attach-javadoc</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>${version.maven-jar}</version>
                        <configuration>
                            <archive>
                                <manifest>
                                    <addClasspath>true</addClasspath>
                                    <classpathPrefix>lib/</classpathPrefix>
                                </manifest>
                            </archive>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-install-plugin</artifactId>
                        <version>${version.maven-install}</version>
                        <configuration>
                            <createChecksum>true</createChecksum>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>


我想达到两个结果之一:

  1. maven-install-plugin忽略.deb包,只安装 *.jar文件和.pom
  2. maven-install-plugin安装两个单独的.deb包,其中包含所有 *.jar和.pom文件。
    我如何做到这一点?
ie3xauqp

ie3xauqp1#

所以我找到了如何实现:maven-install-plugin忽略.deb包,只安装 *.jar文件和.pom。
我需要禁用默认的maven-install-plugin行为,并用自定义行为覆盖它:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-install-plugin</artifactId>
    <version>${version.maven-install}</version>
    <executions>
        <execution>
            <id>default-install</id>
            <phase>install</phase>
            <configuration>
                <skip>true</skip>
            </configuration>
        </execution>
        <execution>
            <id>install</id>
            <phase>install</phase>
            <goals>
                <goal>install-file</goal>
            </goals>
            <configuration>
                <file>target/${project.artifactId}-${project.version}.jar</file>
                <javadoc>target/${project.artifactId}-${project.version}-javadoc.jar</javadoc>
                <groupId>${project.groupId}</groupId>
                <artifactId>${project.artifactId}</artifactId>
                <version>${project.version}</version>
                <packaging>jar</packaging>
                <createChecksum>true</createChecksum>
            </configuration>
        </execution>
    </executions>
</plugin>

字符串

相关问题