gpt4 book ai didi

java - 将独立jar导入本地maven存储库

转载 作者:行者123 更新时间:2023-12-02 03:38:08 27 4
gpt4 key购买 nike

我使用以下命令将无法在线获取的第三方 jar 导入到我的本地 Maven 存储库中,以构建我的项目:

mvn install:install-file -Dfile=C:\Users\MNXE\plugins\myArtifactTest-generate\myArtifactTest-generate-plugin\lib\autoitx4java.jar -DgroupId=com.autoit.code -DartifactId=autoitx4java -Dversion=1.0.0 -Dpackaging=jar -DgeneratePom=true

我的 pom 文件中对该 jar 的依赖关系如下所示:

    <dependency>
<groupId>com.autoit.code</groupId>
<artifactId>autoitx4java</artifactId>
<version>1.0.0</version>
</dependency>

以下是我尝试安装 Maven 项目时出现的错误的完整堆栈跟踪。无论我尝试安装该 jar,还是将该 jar 包含在 Eclipse 的构建路径中,似乎都不起作用。我继续收到编译错误:

C:\Users\MNXE\plugins\myArtifactTest-generate>mvn install -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] OO sample content project
[INFO] myArtifactTest-generate-plugin
[INFO] myArtifactTest-generate-cp
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OO sample content project 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ myArtifactTest
-generate ---
[INFO] Installing C:\Users\MNXE\plugins\myArtifactTest-generate\pom.xml to C:\Us
ers\MNXE\.m2\repository\myGroupTest-generate\myArtifactTest-generate\1.0.0\myArt
ifactTest-generate-1.0.0.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myArtifactTest-generate-plugin 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- oo-action-plugin-maven-plugin:10.20.8:generate-action-plugin (generat
e-contentpack-plugin) @ myArtifactTest-generate-plugin ---
[INFO]
[INFO] --- maven-plugin-plugin:2.9:descriptor (default-descriptor) @ myArtifactT
est-generate-plugin ---
[WARNING] Using platform encoding (Cp1250 actually) to read mojo metadata, i.e.
build is platform dependent!
[INFO] Applying mojo extractor for language: java
[INFO] Mojo extractor for language: java found 4 mojo descriptors.
[INFO] Applying mojo extractor for language: bsh
[INFO] Mojo extractor for language: bsh found 0 mojo descriptors.
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ myArtifact
Test-generate-plugin ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1250 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\MNXE\plugins\myArtifactTest-
generate\myArtifactTest-generate-plugin\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ myArtifactTest-
generate-plugin ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1250, i.e. b
uild is platform dependent!
[INFO] Compiling 5 source files to C:\Users\MNXE\plugins\myArtifactTest-generate
\myArtifactTest-generate-plugin\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/MNXE/plugins/myArtifactTest-generate/myArtifactTest-generate-p
lugin/src/main/java/SampleActions.java:[9,20] package autoitx4java does not exis
t
[ERROR] /C:/Users/MNXE/plugins/myArtifactTest-generate/myArtifactTest-generate-p
lugin/src/main/java/SampleActions.java:[123,38] cannot find symbol
symbol: class AutoItX
location: class SampleActions
[ERROR] /C:/Users/MNXE/plugins/myArtifactTest-generate/myArtifactTest-generate-p
lugin/src/main/java/SampleActions.java:[128,41] cannot find symbol
symbol: class AutoItX
location: class SampleActions
[ERROR] /C:/Users/MNXE/plugins/myArtifactTest-generate/myArtifactTest-generate-p
lugin/src/main/java/SampleActions.java:[133,39] cannot find symbol
symbol: class AutoItX
location: class SampleActions
[INFO] 4 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] OO sample content project ......................... SUCCESS [0.817s]
[INFO] myArtifactTest-generate-plugin .................... FAILURE [6.999s]
[INFO] myArtifactTest-generate-cp ........................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.994s
[INFO] Finished at: Thu May 12 11:33:43 CEST 2016
[INFO] Final Memory: 17M/213M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.
1:compile (default-compile) on project myArtifactTest-generate-plugin: Compilati
on failure: Compilation failure:
[ERROR] /C:/Users/MNXE/plugins/myArtifactTest-generate/myArtifactTest-generate-p
lugin/src/main/java/SampleActions.java:[9,20] package autoitx4java does not exis
t
[ERROR] /C:/Users/MNXE/plugins/myArtifactTest-generate/myArtifactTest-generate-p
lugin/src/main/java/SampleActions.java:[123,38] cannot find symbol
[ERROR] symbol: class AutoItX
[ERROR] location: class SampleActions
[ERROR] /C:/Users/MNXE/plugins/myArtifactTest-generate/myArtifactTest-generate-p
lugin/src/main/java/SampleActions.java:[128,41] cannot find symbol
[ERROR] symbol: class AutoItX
[ERROR] location: class SampleActions
[ERROR] /C:/Users/MNXE/plugins/myArtifactTest-generate/myArtifactTest-generate-p
lugin/src/main/java/SampleActions.java:[133,39] cannot find symbol
[ERROR] symbol: class AutoItX
[ERROR] location: class SampleActions
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on p
roject myArtifactTest-generate-plugin: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:213)
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.buildProje
ct(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compila
tion failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(Abstrac
tCompilerMojo.java:858)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.ja
va:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:209)
... 19 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command

[ERROR] mvn <goals> -rf :myArtifactTest-generate-plugin
C:\Users\MNXE\plugins\myArtifactTest-generate>

最佳答案

我认为您的 jar 文件名中缺少版本号。您的 jar 文件名应为 autoitx4java-1.0.0.jar

关于java - 将独立jar导入本地maven存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37185361/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com