Как указать версию maven-install-plugin при выполнении maven-archetype-plugin: 3.0.1: интеграция-тест - PullRequest
0 голосов
/ 24 июня 2019

Произошла ошибка при запуске mvn clean install -DskipTests.Сообщение об ошибке: Failed to execute goal org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install (default-install) on project feature: NoFileAssignedException: The packaging plugin for this project did not assign a main file to the project but it has attachments. Change packaging to 'pom'. -> [Help 1]

По аналогичной проблеме ( как исправить ошибки сборки для кода Maven Mulesoft ) я попытался изменить pom на

<modelVersion>4.0.0</modelVersion>

<parent>
    <groupId>org.apache.karaf</groupId>
    <artifactId>archetypes</artifactId>
    <version>4.1.6</version>
    <relativePath>../pom.xml</relativePath>
</parent>

<groupId>org.apache.karaf.archetypes</groupId>
<artifactId>karaf-feature-archetype</artifactId>
<packaging>maven-archetype</packaging>
<name>Apache Karaf :: Archetypes :: Feature Archetype</name>
<description>This archetype sets up an empty karaf features project.</description>

<properties>
    <archetype.version>3.0.1</archetype.version>
</properties>

<build>
    <resources>
        <resource>
            <directory>${project.basedir}/src/main/resources</directory>
            <filtering>true</filtering>
            <includes>
                <include>**/*</include>
            </includes>
        </resource>
    </resources>

    <extensions>
        <extension>
            <groupId>org.apache.maven.archetype</groupId>
            <artifactId>archetype-packaging</artifactId>
            <version>${archetype.version}</version>
        </extension>
    </extensions>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.5.2</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.8.2</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <configuration>
                <delimiters>
                    <delimiter>^*^</delimiter>
                </delimiters>
                <useDefaultDelimiters>false</useDefaultDelimiters>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-archetype-plugin</artifactId>
        </plugin>
    </plugins>

    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-archetype-plugin</artifactId>
                <version>${archetype.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>2.5.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

Но у меня это не работает.

В соответствии с изменением команды mvn на mvn clean install -DskipTests -X я обнаружил, что версия maven-install-plugin изменилась на 2.5.2.Но при выполнении maven-archetype-plugin:3.0.1:integration-test версия maven-install-plugin по-прежнему 3.0.0-M1.

Мой вопрос:

  1. Как указать версию maven-install-plugin при выполнении maven-archetype-plugin:3.0.1:integration-test

Несколько любопытных вопросов:

Почему команда -DskipTests не работает на maven-archetype-plugin, есть ли способ пропустить тесты при сборке проекта? Существует ли какая-либо связь между maven-archetype-plugin и maven-install-plugin?Я не могу найти никаких отношений на веб-сайте репозитория maven. Я создаю исходный код karaf (из github).Мой обходной путь - удалить цели в goal.text в папке test, это хороший метод?

Некоторые из отладочных выводов:

E:\ws-karaf\karaf-karaf-4.1.6\archetypes\feature>mvn clean install -DskipTest -X
[DEBUG] Goal:          org.apache.maven.plugins:maven-clean-plugin:3.0.0:clean (default-clean)
...
[DEBUG] Goal:          org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-maven)
...
[DEBUG] Goal:          org.apache.felix:maven-bundle-plugin:3.5.0:cleanVersions (cleanVersions)
...
[DEBUG] Goal:          org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process (process-resource-bundles)
...
[DEBUG] Goal:          org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process (default)
...
[DEBUG] Goal:          org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources (default-resources)
...
[DEBUG] Goal:          org.apache.maven.plugins:maven-resources-plugin:3.0.2:testResources (default-testResources)
...
[DEBUG] Goal:          org.apache.maven.plugins:maven-archetype-plugin:3.0.1:jar (default-jar)
...
[DEBUG] Goal:          org.apache.maven.plugins:maven-site-plugin:3.6:attach-descriptor (attach-descriptor)
...
[DEBUG] Goal:          org.apache.maven.plugins:maven-archetype-plugin:3.0.1:integration-test (default-integration-test)
...
[DEBUG] Goal:          org.apache.maven.plugins:maven-install-plugin:2.5.2:install (default-install)
...
[DEBUG] Goal:          org.apache.maven.plugins:maven-archetype-plugin:3.0.1:update-local-catalog (default-update-local-catalog)
...
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ karaf-feature-archetype ---
...
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ karaf-feature-archetype ---
...
[INFO] --- maven-bundle-plugin:3.5.0:cleanVersions (cleanVersions) @ karaf-feature-archetype ---
...
[INFO] --- maven-remote-resources-plugin:1.5:process (process-resource-bundles) @ karaf-feature-archetype ---
...
[INFO] --- maven-remote-resources-plugin:1.5:process (default) @ karaf-feature-archetype ---
...
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ karaf-feature-archetype ---
...
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ karaf-feature-archetype ---
...
[INFO] --- maven-archetype-plugin:3.0.1:jar (default-jar) @ karaf-feature-archetype ---
...
[INFO] --- maven-site-plugin:3.6:attach-descriptor (attach-descriptor) @ karaf-feature-archetype ---
...
[INFO] --- maven-archetype-plugin:3.0.1:integration-test (default-integration-test) @ karaf-feature-archetype ---
...
[INFO] [INFO] Error stacktraces are turned on.
[INFO] [INFO] Scanning for projects...
[INFO] [INFO]
[INFO] [INFO] ------------------------< archetype.it:feature >------------------------
[INFO] [INFO] Building feature-feature 1.0-SNAPSHOT
[INFO] [INFO] ------------------------------[ feature ]-------------------------------
[INFO] [INFO]
[INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ feature ---
[INFO] [INFO]
[INFO] [INFO] --- karaf-maven-plugin:4.1.6:features-generate-descriptor (default-features-generate-descriptor) @ feature ---
[INFO] [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] [INFO]
[INFO] [INFO] --- karaf-maven-plugin:4.1.6:verify (default-verify) @ feature ---
[INFO] [INFO] Using repositories: https://repo.maven.apache.org/maven2@id=central
[INFO] [INFO]
[INFO] [INFO] --- maven-install-plugin:3.0.0-M1:install (default-install) @ feature ---
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time:  1.912 s
[INFO] [INFO] Finished at: 2019-06-24T11:54:31+08:00
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install (default-install) on project feature: NoFileAssignedException: The packaging plugin for this project did not assign a main file to the project but it has attachments. Change packaging to 'pom'. -> [Help 1]
[INFO] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install (default-install) on project feature: NoFileAssignedException
[INFO]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
[INFO]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[INFO]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[INFO]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
[INFO]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
[INFO]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
[INFO]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
[INFO]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
[INFO]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
[INFO]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
[INFO]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
[INFO]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
[INFO]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
[INFO]     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
[INFO]     at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
[INFO]     at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
[INFO]     at java.lang.reflect.Method.invoke (Method.java:498)
[INFO]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
[INFO]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
[INFO]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
[INFO]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[INFO] Caused by: org.apache.maven.plugin.MojoExecutionException: NoFileAssignedException
[INFO]     at org.apache.maven.plugins.install.InstallMojo.installProject (InstallMojo.java:152)
[INFO]     at org.apache.maven.plugins.install.InstallMojo.execute (InstallMojo.java:108)
[INFO]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
[INFO]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
[INFO]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[INFO]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[INFO]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
[INFO]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
[INFO]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
[INFO]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
[INFO]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
[INFO]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
[INFO]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
[INFO]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
[INFO]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
[INFO]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
[INFO]     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
[INFO]     at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
[INFO]     at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
[INFO]     at java.lang.reflect.Method.invoke (Method.java:498)
[INFO]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
[INFO]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
[INFO]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
[INFO]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[INFO] Caused by: org.apache.maven.shared.transfer.project.NoFileAssignedException: The packaging plugin for this project did not assign a main file to the project but it has attachments. Change packaging to 'pom'.
[INFO]     at org.apache.maven.shared.transfer.project.install.internal.DefaultProjectInstaller.install (DefaultProjectInstaller.java:116)
[INFO]     at org.apache.maven.plugins.install.InstallMojo.installProject (InstallMojo.java:140)
[INFO]     at org.apache.maven.plugins.install.InstallMojo.execute (InstallMojo.java:108)
[INFO]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
[INFO]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
[INFO]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[INFO]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[INFO]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
[INFO]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
[INFO]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
[INFO]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
[INFO]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
[INFO]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
[INFO]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
[INFO]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
[INFO]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
[INFO]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
[INFO]     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
[INFO]     at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
[INFO]     at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
[INFO]     at java.lang.reflect.Method.invoke (Method.java:498)
[INFO]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
[INFO]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
[INFO]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
[INFO]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[INFO] [ERROR]
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR]
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO] Post-archetype-generation invoker exit code: 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  16.786 s
[INFO] Finished at: 2019-06-24T11:54:32+08:00
...
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...