我有一个maven项目,编译和部署没有任何问题。我正在尝试使用该版本:准备目标但我收到错误。我用google搜索并了解插件可以给出前缀,错误意味着它找不到前缀为“C”的插件。我不知道它为什么要寻找带有这个前缀的插件。
我的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>
<scm>
<connection>scm:git:ssh://git@gitlab.com:rmetcalf9/ICSchema_SAMPLE_UTIL_SCHEMA.git</connection>
<url>ssh://git@gitlab.com:rmetcalf9/ICSchema_SAMPLE_UTIL_SCHEMA.git</url>
<tag>ICSchema_SAMPLE_UTIL_SCHEMA-0.0.1</tag>
</scm>
<groupId>metcarob.com.oracledb.sample.schema</groupId>
<artifactId>ICSchema_SAMPLE_UTIL_SCHEMA</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>ICSchema_SAMPLE_UTIL_SCHEMA</name>
<url>http://maven.apache.org</url>
<!--
Command line parameters:
cmd.env - the environment this project is to be deployed to (dev/test/prod/etc)
cmd.parent.sys (OPTIONAL) - for UTILITY schemas this designates the system to use for deployment.
this is overridden by the pom property ic.pom.sys if present
-->
<properties>
<ic.ci.deployment.type>OracleDB</ic.ci.deployment.type>
<ic.ci.resourcedir>${project.basedir}/src/main/resources</ic.ci.resourcedir>
<ic.db.ciuser>CIDBADMIN</ic.db.ciuser>
<ic.db.ciuserpass>PASSWORD_REMOVED_FROM_POST</ic.db.ciuserpass>
<ic.db.schema.name>SAMPLE_UTIL_SCHEMA</ic.db.schema.name>
<ic.db.schema.objecttable>schema_objects</ic.db.schema.objecttable>
<ic.db.sqlplus.connectstring>${ic.db.ciuser}/${ic.db.ciuserpass}@${ic.db.host}:${ic.db.port}/${ic.db.service_name}</ic.db.sqlplus.connectstring>
<ic.db.jdbc.connectstring>jdbc:oracle:thin:@(DESCRIPTION=(enable=broken)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=${ic.db.host})(PORT=${ic.db.port})))(CONNECT_DATA=(service_name=${ic.db.service_name})))</ic.db.jdbc.connectstring>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
<snapshotRepository>
<id>ssh-repository</id>
<name>ssh-repository</name>
<url>scpexe://mvn.metcarob.com:7456/public_snapshots</url>
</snapshotRepository>
<repository>
<id>ssh-repository</id>
<name>ssh-repository</name>
<url>scpexe://mvn.metcarob.com:7456/public</url>
</repository>
</distributionManagement>
<repositories>
<repository>
<id>ic_snapshot</id>
<url>https://mvnsnap.metcarob.com</url>
</repository>
<repository>
<id>ic_main</id>
<url>https://mvn.metcarob.com</url>
</repository>
</repositories>
<build>
<plugins>
<!-- First plugin will caculate the sys property -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<id>bsh-property</id>
<goals>
<goal>bsh-property</goal>
</goals>
<configuration>
<properties>
<property>ic.actual.sys</property>
</properties>
<source>
ic.actual.sys = project.getProperties().getProperty("ic.pom.sys", session.getUserProperties().getProperty("cmd.parent.sys"));
</source>
</configuration>
</execution>
</executions>
</plugin>
<!-- Second plugin will read property values at the start of the validate phase -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
</execution>
</executions>
<configuration>
<files>
<file>${env.CIICENV_HOME}/${cmd.env}/${ic.actual.sys}.properties</file>
</files>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>deploy-dependancies</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>ci_deployer</executable>
<arguments>
<argument>${project.basedir}/pom.xml</argument>
<argument>NULL</argument>
<argument>${cmd.env}</argument>
<argument>${ic.actual.sys}</argument>
</arguments>
<workingDirectory>${ic.ci.resourcedir}</workingDirectory>
</configuration>
</execution>
<execution>
<id>pre-hook</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sqlplus</executable>
<arguments>
<argument>${ic.db.sqlplus.connectstring}</argument>
<argument>as</argument>
<argument>sysdba</argument>
<argument>@_control.sql</argument>
<argument>${ic.db.schema.name}</argument>
</arguments>
<workingDirectory>${ic.ci.resourcedir}/db/pre_migration</workingDirectory>
</configuration>
</execution>
<execution>
<id>sqlcodedeploy-setup</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sqlcodedeploy_setup</executable>
<arguments>
<argument>${ic.ci.resourcedir}/db/code</argument>
<argument>${ic.db.sqlplus.connectstring}</argument>
<argument>${ic.db.schema.name}</argument>
<argument>${project.version}</argument>
<argument>${ic.db.schema.objecttable}</argument>
</arguments>
<workingDirectory>${ic.ci.resourcedir}/db/code</workingDirectory>
</configuration>
</execution>
<execution>
<id>migrate-datastructures</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>ci_flyway</executable>
<arguments>
<argument>"${ic.db.jdbc.connectstring}"</argument>
<argument>"${ic.db.ciuser}"</argument>
<argument>"${ic.db.ciuserpass}"</argument>
<argument>"${ic.db.schema.name}"</argument>
<argument>"${ic.ci.resourcedir}/db/migration"</argument>
</arguments>
<workingDirectory>${ic.ci.resourcedir}</workingDirectory>
</configuration>
</execution>
<execution>
<id>deploy-code</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sqlcodedeploy</executable>
<arguments>
<argument>${ic.ci.resourcedir}/db/code</argument>
<argument>${ic.db.sqlplus.connectstring}</argument>
<argument>${ic.db.schema.name}</argument>
<argument>${project.version}</argument>
<argument>${ic.db.schema.objecttable}</argument>
</arguments>
<workingDirectory>${ic.ci.resourcedir}/db/code</workingDirectory>
</configuration>
</execution>
<execution>
<id>sqlplusmulti-runtests</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sqlplusmulti</executable>
<arguments>
<argument>${project.basedir}/src/test/resources/db/code</argument>
<argument>${ic.db.sqlplus.connectstring}</argument>
<argument>${ic.db.schema.name}</argument>
<argument>*.sql</argument>
</arguments>
<workingDirectory>${project.basedir}/src/test/resources/db/code</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<extensions>
<!-- Enabling the use of SSH -->
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>2.10</version>
</extension>
</extensions>
</build>
</project>
我使用命令mvn -X release:prepare -Dcmd.env = dev -Dcmd.parent.sys = soa来运行它,输出对于帖子而言太大了,但相关部分是:
INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (13 KB at 43.2 KB/sec)
[INFO] [DEBUG] Writing tracking file C:\off_desk\eclipse_workspaces\CITesting\ICSchema_SAMPLE_UTIL_SCHEMA\true\org\apache\maven\plugins\resolver-status.properties
[INFO]
[INFO] Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 KB at 66.9 KB/sec)
[INFO] [DEBUG] Writing tracking file C:\off_desk\eclipse_workspaces\CITesting\ICSchema_SAMPLE_UTIL_SCHEMA\true\org\codehaus\mojo\resolver-status.properties
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 0.890 s
[INFO] [INFO] Finished at: 2016-09-23T12:39:47+01:00
[INFO] [INFO] Final Memory: 12M/304M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] No plugin found for prefix 'C' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\off_desk\eclipse_workspaces\CITesting\ICSchema_SAMPLE_UTIL_SCHEMA\true), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[INFO] org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found for prefix 'C' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\off_desk\eclipse_workspaces\CITesting\ICSchema_SAMPLE_UTIL_SCHEMA\true), central (https://repo.maven.apache.org/maven2)]
[INFO] at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolve(DefaultPluginPrefixResolver.java:93)
[INFO] at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.findPluginForPrefix(MojoDescriptorCreator.java:265)
[INFO] at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:219)
[INFO] at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:103)
[INFO] at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:83)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:89)
[INFO] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
[INFO] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
[INFO] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
[INFO] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
[INFO] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[INFO] at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
[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:497)
[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]
[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/NoPluginFoundForPrefixException
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping ICSchema_SAMPLE_UTIL_SCHEMA
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.663 s
[INFO] Finished at: 2016-09-23T12:39:47+01:00
[INFO] Final Memory: 13M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project ICSchema_SAMPLE_UTIL_SCHEMA: Maven execution failed, exit code: '1' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project ICSchema_SAMPLE_UTIL_SCHEMA: Maven execution failed, exit code: '1'
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Maven execution failed, exit code: '1'
at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:295)
at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:247)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: org.apache.maven.shared.release.ReleaseExecutionException: Maven execution failed, exit code: '1'
at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute(AbstractRunGoalsPhase.java:89)
at org.apache.maven.shared.release.phase.RunPrepareGoalsPhase.execute(RunPrepareGoalsPhase.java:44)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107)
at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:291)
... 23 more
Caused by: org.apache.maven.shared.release.exec.MavenExecutorException: Maven execution failed, exit code: '1'
at org.apache.maven.shared.release.exec.InvokerMavenExecutor.executeGoals(InvokerMavenExecutor.java:409)
at org.apache.maven.shared.release.exec.AbstractMavenExecutor.executeGoals(AbstractMavenExecutor.java:85)
at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute(AbstractRunGoalsPhase.java:81)
... 29 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
这为前缀C&#34;找到了#34; No Plugin。 有没有人有任何关于在哪里寻找缩小原因的建议?
我已经尝试从pom中注释掉所有插件,但我仍然遇到同样的错误。
答案 0 :(得分:1)
我的问题是由我推出maven的方式引起的。我在中央批处理目录中为它创建了一个批处理脚本。这适用于
mvn package
mvn deploy
etc.
但不是发布插件。
我不得不把maven放在我的路上。我收到另一个错误,抱怨maven找不到mvn.bat。我查看了maven目录
C:\Program Files\Apache\apache-maven-3.3.9\bin
我找到了“mvn”和“mvn.cmd”,但没有找到“mvn.bat”。 我将“mvn.cmd”复制到“mvn.bat”,它现在似乎有效了。
然后我发现我的论点被忽略了。我发现我需要以一种奇怪的方式调用mvn来使参数起作用:mvn release:prepare -Darguments="-Dcmd.env=dev -Dcmd.parent.sys=soa"
最后它奏效了。 (好吧,我现在正在调整一个与git相关的问题) 谢谢大家的帮助
答案 1 :(得分:0)
我认为这是将参数传递给release插件的正确方法。 否则,发布插件会忽略属性的值。
或者在您的pom文件中,在maven-release-plugin的配置中,您应该: $ {} releaseParams 要么 -Dparam = $ value -Dparam = $ value