Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 自定义Maven插件托管和前缀解析_Java_Maven_Maven Plugin_Archiva - Fatal编程技术网

Java 自定义Maven插件托管和前缀解析

Java 自定义Maven插件托管和前缀解析,java,maven,maven-plugin,archiva,Java,Maven,Maven Plugin,Archiva,我已经编写了自己的自定义Maven插件,并将其上传到我的Archiva服务器。使用指定的全名,它可以正常工作: mvn com.mjolnirr:maven-plugin:manifest 但当我想通过前缀执行时,它失败了: mvn mjolnirr:manifest [ERROR] No plugin found for prefix 'mjolnirr' in the current project and in the plugin groups [org.apache.maven.p

我已经编写了自己的自定义
Maven
插件,并将其上传到我的
Archiva
服务器。使用指定的全名,它可以正常工作:

mvn com.mjolnirr:maven-plugin:manifest
但当我想通过前缀执行时,它失败了:

mvn mjolnirr:manifest

[ERROR] No plugin found for prefix 'mjolnirr' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/sk_/.m2/repository), mjolnirr (http://mjolnirr.dyndns.org/archiva/repository/plugins), central (http://repo.maven.apache.org/maven2)] -> [Help 1]
我的插件的
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>com.mjolnirr</groupId>
<artifactId>mjolnirr-maven-plugin</artifactId>
<version>0.2</version>
<packaging>maven-plugin</packaging>

<name>Mjolnirr Maven Plugin</name>

<url>http://mjolnirr.com</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
    <repository>
        <id>mjolnirr</id>
        <name>Mjolnirr snapshot repository</name>
        <url>http://mjolnirr.com/archiva/repository/snapshots</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>mjolnirr</id>
        <name>Maven Plugin Repository</name>
        <url>http://mjolnirr.com/archiva/repository/snapshots</url>
    </pluginRepository>
</pluginRepositories>

<dependencies>

    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-core</artifactId>
        <version>3.0.3</version>
    </dependency>

    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-plugin-api</artifactId>
        <version>3.0.3</version>
    </dependency>

    <dependency>
        <groupId>org.apache.maven.plugin-tools</groupId>
        <artifactId>maven-plugin-annotations</artifactId>
        <version>3.2</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-utils</artifactId>
        <version>3.0.8</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
    </dependency>

    <!-- For superclass resolving -->
    <dependency>
        <groupId>com.mjolnirr</groupId>
        <artifactId>core</artifactId>
        <version>0.2</version>
    </dependency>

    <!-- For XML producing -->
    <dependency>
        <groupId>com.thoughtworks.xstream</groupId>
        <artifactId>xstream</artifactId>
        <version>1.4.5</version>
    </dependency>

</dependencies>

<build>
    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-plugin-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <goalPrefix>mjolnirr</goalPrefix>
                <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
            </configuration>
            <executions>
                <execution>
                    <id>mojo-descriptor</id>
                    <goals>
                        <goal>descriptor</goal>
                    </goals>
                </execution>
                <execution>
                    <id>help-goal</id>
                    <goals>
                        <goal>helpmojo</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>
<profiles>
    <profile>
        <id>run-its</id>
        <build>

            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-invoker-plugin</artifactId>
                    <version>1.7</version>
                    <configuration>
                        <debug>true</debug>
                        <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                        <pomIncludes>
                            <pomInclude>*/pom.xml</pomInclude>
                        </pomIncludes>
                        <postBuildHookScript>verify</postBuildHookScript>
                        <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                        <settingsFile>src/it/settings.xml</settingsFile>
                        <goals>
                            <goal>clean</goal>
                            <goal>test-compile</goal>
                        </goals>
                    </configuration>
                    <executions>
                        <execution>
                            <id>integration-test</id>
                            <goals>
                                <goal>install</goal>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>

        </build>
    </profile>
</profiles>
</project>

4.0.0
com.mjolnirr
mjolnirr maven插件
0.2
maven插件
Mjolnirr Maven插件
http://mjolnirr.com
UTF-8
mjolnirr
Mjolnirr快照存储库
http://mjolnirr.com/archiva/repository/snapshots
mjolnirr
Maven插件库
http://mjolnirr.com/archiva/repository/snapshots
org.apache.maven
马文堆芯
3.0.3
org.apache.maven
maven插件api
3.0.3
org.apache.maven.plugin-tools
maven插件注释
3.2
假如
org.codehaus.plexus
尾丛
3.0.8
朱尼特
朱尼特
4.8.2
测试
com.mjolnirr
核心
0.2
com.thoughtworks.xstream
xstream
1.4.5
org.apache.maven.plugins
maven插件
3.2
mjolnirr
真的
魔咒描述符
描述符
帮助目标
帮助魔咒
运行
org.apache.maven.plugins
maven调用器插件
1.7
真的
${project.build.directory}/it
*/pom.xml
验证
${project.build.directory}/local repo
src/it/settings.xml
清洁的
测试编译
集成测试
安装
集成测试
验证
看起来我必须在我的存储库中添加一些定义。你能帮我吗


ADD我发现maven试图从
org/apache/maven/plugins
下载
maven metadata.xml
。是否可以在项目POM中更改此路径,而不更改maven设置?

默认情况下,只搜索groupId为
org.apache.maven.plugins
的插件

要让Maven搜索插件的其他GroupID,可以在每个用户的settings.xml文件中配置其他插件组,例如:

<pluginGroups>
    <pluginGroup>org.mortbay.jetty</pluginGroup>
    <pluginGroup>org.apache.tomcat.maven</pluginGroup>
</pluginGroups>

org.mortbay.jetty
org.apache.tomcat.maven

有关这方面的详细信息,请参阅。

Hmm,我使用Maven JavaFX插件,我可以运行
mvn jfx:run
,但没有您提到的groupId。@skayred
jfx:run
对我不起作用。它的组ID肯定没有在
settings.xml
中定义?对我来说也是这样,但是那些家伙在项目中使用了特殊的pom.xml前缀-是的,我是对的-你可以在第一次使用完全指定的名称后使用前缀