Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/388.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 无法解析项目org.openjdk.jmh:jmh-core:jar:1.21的依赖项_Java_Maven_Intellij Idea_Java 8_Jmh - Fatal编程技术网

Java 无法解析项目org.openjdk.jmh:jmh-core:jar:1.21的依赖项

Java 无法解析项目org.openjdk.jmh:jmh-core:jar:1.21的依赖项,java,maven,intellij-idea,java-8,jmh,Java,Maven,Intellij Idea,Java 8,Jmh,我想从现在开始写方法的基准测试,我有很长时间的动力,最后决定从昨天开始写。但我对我的设置过程印象深刻 我已经正确安装了JMH插件 所有进口产品都很好 甚至我的POM也没有显示错误 但是当我运行命令mvn clean install时,我得到以下错误: [错误]无法在项目测试上执行目标可选:无法 解决项目的依赖关系 Vishwaratna:TestOptional:jar:1.0-SNAPSHOT:以下工件 无法解析d:org.openjdk.jmh:jmh-core:jar:1.21, jm

我想从现在开始写方法的基准测试,我有很长时间的动力,最后决定从昨天开始写。但我对我的设置过程印象深刻

  • 我已经正确安装了JMH插件
  • 所有进口产品都很好
  • 甚至我的POM也没有显示错误
但是当我运行命令
mvn clean install
时,我得到以下错误:

[错误]无法在项目测试上执行目标可选:无法 解决项目的依赖关系 Vishwaratna:TestOptional:jar:1.0-SNAPSHOT:以下工件 无法解析d:org.openjdk.jmh:jmh-core:jar:1.21, jmh:jmh进程:jar:1.21:找不到 art_all中的artifact org.openjdk.jmh:jmh core:jar:1.21 (bs快照)

我认为我必须强制更新repos,所以我运行了
mvn-U clean install
,同样没有运气

做了大量的搜索,浏览了N个SO线程,但仍然无法找出我的错误所在

当我刚刚运行Testing.java类时,我得到以下消息:

没有匹配的基准。拼写错误的regexp?

使用额外详细模式调试模式匹配。

进程已完成,退出代码为1

我感到困惑的是,当maven无法从中央代表处找到这些JMH LIB时,为什么我的带有所有注释的代码没有显示红色编译错误??如果正确导入了LIB,那么当我从终端运行
mvn clean install
时,为什么会出现xx无法下载的错误

经过两个小时的努力,我想放弃POM.xml并尝试手动添加jar,我下载了JMH注释jar和JMH核心jar,并手动配置了路径。你猜怎么着?还是没有运气

如果您想知道我在编码什么:

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;

public class Testing {
    @Benchmark
    @BenchmarkMode({ Mode.AverageTime})
    public void wellHelloThere() {
        // this method was intentionally left blank.
    }
    public static void main(String[] args) throws RunnerException {
        Options opt = new OptionsBuilder()
            .include(Testing.class.getSimpleName())
            .forks(1)
            .build();

        new Runner(opt).run();
    }
}
My POM.XML

<?xml version="1.0" encoding="UTF-8"?>
<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>Vishwaratna</groupId>
    <artifactId>TestOptional</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <jmh.version>1.21</jmh.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-core</artifactId>
            <version>${jmh.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-generator-annprocess</artifactId>
            <version>${jmh.version}</version>
        </dependency>
    </dependencies>
    <repositories>

            <repository>
                <id>central-repo</id>
                <name>Central Repository</name>
                <url>http://repo1.maven.org/maven2</url>
                <releases>
                    <enabled>false</enabled>
                    <updatePolicy>always</updatePolicy>
                    <checksumPolicy>warn</checksumPolicy>
                </releases>
            </repository>


    </repositories>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>

                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.openjdk.jmh</groupId>
                            <artifactId>jmh-generator-annprocess</artifactId>
                            <version>1.21</version>
                        </path>
                    </annotationProcessorPaths>

                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>run-benchmarks</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <classpathScope>test</classpathScope>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath />
                                <argument>org.openjdk.jmh.Main</argument>
                                <argument>.*</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>

                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>


</project>
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <localRepository>C:\GBO_ROOT\Repo</localRepository> 

    <servers>
        <server>
            <id>TomcatServer</id>
            <username>admin</username>
            <password>password</password>
        </server>
    </servers>
    <mirrors>   
     <mirror> 
      <id>art_central</id> 
      <name>Artifactory Mirror of Central</name> 
      <url>http://maven/artifactory/libs-snapshot</url> 
      <mirrorOf>central</mirrorOf> 
    </mirror> 
    <mirror> 
      <id>art_all</id> 
      <name>Artifactory Mirror of Central</name> 
      <url>http://maven/artifactory/libs-snapshot</url> 
      <mirrorOf>*</mirrorOf> 
    </mirror> 
  </mirrors>
  <profiles>
    <profile>  
      <id>artifactory</id>  
      <repositories>  
        <repository>  
          <snapshots />  
          <id>snapshots</id>  
          <name>libs-snapshot</name>  
          <url>http://maven/artifactory/libs-snapshot</url>   
        </repository>  
      </repositories>  
      <pluginRepositories>  
        <pluginRepository>  
          <snapshots />  
          <id>snapshots</id>  
          <name>plugins-snapshot</name>  
          <url>http://maven/artifactory/plugins-snapshot</url>   
        </pluginRepository>  
      </pluginRepositories>  
    </profile>  
  </profiles>

  <activeProfiles>  
    <activeProfile>artifactory</activeProfile>  
  </activeProfiles>
</settings>
编辑:

<?xml version="1.0" encoding="UTF-8"?>

<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"
          xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <localRepository>C:/EMA_ROOT/snapshotviews/repo</localRepository>     
  <mirrors>   
     <mirror> 
      <id>art_central</id> 
      <name>Artifactory Mirror of Central</name> 
      <url>http://maven/artifactory/libs-snapshot</url> 
      <mirrorOf>central</mirrorOf> 
    </mirror> 
    <mirror> 
      <id>art_all</id> 
      <name>Artifactory Mirror of Central</name> 
      <url>http://maven/artifactory/libs-snapshot</url> 
      <mirrorOf>*</mirrorOf> 
    </mirror> 
  </mirrors>
  <profiles>
    <profile>  
      <id>artifactory</id>  
      <repositories>  
        <repository>  
          <snapshots />  
          <id>snapshots</id>  
          <name>libs-snapshot</name>  
          <url>http://maven/artifactory/libs-snapshot</url>   
        </repository>  
      </repositories>  
      <pluginRepositories>  
        <pluginRepository>  
          <snapshots />  
          <id>snapshots</id>  
          <name>plugins-snapshot</name>  
          <url>http://maven/artifactory/plugins-snapshot</url>   
        </pluginRepository>  
      </pluginRepositories>  
    </profile>  
  </profiles>

  <activeProfiles>  
    <activeProfile>artifactory</activeProfile>  
  </activeProfiles>
</settings>
使用命令mvn-U clean install,我强制更新repos,并获得了这些下载

拾取的JAVA选项:-Djava.net.preferIPv4Stack=true[INFO] 正在扫描项目。。。[警告][警告]出现了一些问题 在为构建有效模型时遇到 Vishwaratna:TestOptional:jar:1.0-SNAPSHOT[警告] “build.plugins.plugin.(groupId:artifactId)”必须是唯一的,但可以找到 插件的重复声明 plugins:maven编译器插件@86行第21列 [警告]“build.plugins.plugin.version”用于 插件:缺少maven编译器插件。@第86行, 第21列[警告]“build.plugins.plugin.version”用于 org.codehaus.mojo:exec maven插件丢失。@第63行第21列 [警告][警告]强烈建议解决这些问题 因为它们会威胁到你身体的稳定性。[警告][警告] 因此,未来的Maven版本可能不再支持 构建这种畸形的项目。[警告][信息][信息] ------------------------------------------------------------------------[信息]构建测试可选1.0-SNAPSHOT[信息] ------------------------------------------------------------------------下载: 下载: 下载: (0.2 KB/秒时为873 B)下载: (0.2 KB/秒时为873 B)下载: 下载: [警告]org.openjdk.jmh:jmh core:jar:1.21的POM丢失,否 可下载的依赖项信息: 下载: [警告]POM用于 jmh:jmh进程:jar:1.21丢失,否 可下载的依赖项信息: 下载: 下载: 下载: [信息] ------------------------------------------------------------------------[信息]生成失败[信息] ------------------------------------------------------------------------[信息]总时间:17.150秒[信息]完成时间: 2019-04-10T14:57:16+05:30[信息]最终内存:7M/125M[信息] ------------------------------------------------------------------------[错误]无法在项目测试上执行目标可选:无法 解决项目的依赖关系 Vishwaratna:TestOptional:jar:1.0-SNAPSHOT:以下工件 无法解析d:org.openjdk.jmh:jmh-core:jar:1.21, jmh:jmh进程:jar:1.21:找不到 art_all中的artifact org.openjdk.jmh:jmh core:jar:1.21 (bs快照)

这表明我没有任何代理问题,现在当我在浏览器中点击任何JMH链接时,我得到一个json响应,例如:

链接:

味精:


设置XML

<?xml version="1.0" encoding="UTF-8"?>
<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>Vishwaratna</groupId>
    <artifactId>TestOptional</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <jmh.version>1.21</jmh.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-core</artifactId>
            <version>${jmh.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-generator-annprocess</artifactId>
            <version>${jmh.version}</version>
        </dependency>
    </dependencies>
    <repositories>

            <repository>
                <id>central-repo</id>
                <name>Central Repository</name>
                <url>http://repo1.maven.org/maven2</url>
                <releases>
                    <enabled>false</enabled>
                    <updatePolicy>always</updatePolicy>
                    <checksumPolicy>warn</checksumPolicy>
                </releases>
            </repository>


    </repositories>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>

                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.openjdk.jmh</groupId>
                            <artifactId>jmh-generator-annprocess</artifactId>
                            <version>1.21</version>
                        </path>
                    </annotationProcessorPaths>

                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>run-benchmarks</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <classpathScope>test</classpathScope>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath />
                                <argument>org.openjdk.jmh.Main</argument>
                                <argument>.*</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>

                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>


</project>
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <localRepository>C:\GBO_ROOT\Repo</localRepository> 

    <servers>
        <server>
            <id>TomcatServer</id>
            <username>admin</username>
            <password>password</password>
        </server>
    </servers>
    <mirrors>   
     <mirror> 
      <id>art_central</id> 
      <name>Artifactory Mirror of Central</name> 
      <url>http://maven/artifactory/libs-snapshot</url> 
      <mirrorOf>central</mirrorOf> 
    </mirror> 
    <mirror> 
      <id>art_all</id> 
      <name>Artifactory Mirror of Central</name> 
      <url>http://maven/artifactory/libs-snapshot</url> 
      <mirrorOf>*</mirrorOf> 
    </mirror> 
  </mirrors>
  <profiles>
    <profile>  
      <id>artifactory</id>  
      <repositories>  
        <repository>  
          <snapshots />  
          <id>snapshots</id>  
          <name>libs-snapshot</name>  
          <url>http://maven/artifactory/libs-snapshot</url>   
        </repository>  
      </repositories>  
      <pluginRepositories>  
        <pluginRepository>  
          <snapshots />  
          <id>snapshots</id>  
          <name>plugins-snapshot</name>  
          <url>http://maven/artifactory/plugins-snapshot</url>   
        </pluginRepository>  
      </pluginRepositories>  
    </profile>  
  </profiles>

  <activeProfiles>  
    <activeProfile>artifactory</activeProfile>  
  </activeProfiles>
</settings>

C:\GBO\u ROOT\Repo
TomcatServer
管理
密码
艺术中心
中央人工反射镜
http://maven/artifactory/libs-snapshot 
中心的
艺术
中央人工反射镜
http://maven/artifactory/libs-snapshot 
* 
人工制品
快照
libs快照
http://maven/artifactory/libs-snapshot   
快照
插件快照
http://maven/artifactory/plugins-snapshot   
人工制品
设置工件xml:

<?xml version="1.0" encoding="UTF-8"?>

<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"
          xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <localRepository>C:/EMA_ROOT/snapshotviews/repo</localRepository>     
  <mirrors>   
     <mirror> 
      <id>art_central</id> 
      <name>Artifactory Mirror of Central</name> 
      <url>http://maven/artifactory/libs-snapshot</url> 
      <mirrorOf>central</mirrorOf> 
    </mirror> 
    <mirror> 
      <id>art_all</id> 
      <name>Artifactory Mirror of Central</name> 
      <url>http://maven/artifactory/libs-snapshot</url> 
      <mirrorOf>*</mirrorOf> 
    </mirror> 
  </mirrors>
  <profiles>
    <profile>  
      <id>artifactory</id>  
      <repositories>  
        <repository>  
          <snapshots />  
          <id>snapshots</id>  
          <name>libs-snapshot</name>  
          <url>http://maven/artifactory/libs-snapshot</url>   
        </repository>  
      </repositories>  
      <pluginRepositories>  
        <pluginRepository>  
          <snapshots />  
          <id>snapshots</id>  
          <name>plugins-snapshot</name>  
          <url>http://maven/artifactory/plugins-snapshot</url>   
        </pluginRepository>  
      </pluginRepositories>  
    </profile>  
  </profiles>

  <activeProfiles>  
    <activeProfile>artifactory</activeProfile>  
  </activeProfiles>
</settings>

C:/EMA\u根目录/快照视图/repo
艺术中心
中央人工反射镜
http://maven/artifactory/libs-snapshot 
中心的
艺术
中央人工反射镜
http://maven/artifactory/libs-snapshot 
* 
人工制品