无法构建maven项目

问题描述 投票:0回答:3

嗨,我是maven技术的新手我正在尝试创建并运行maven项目但是我遇到了构建失败错误。在运行项目编译器时无法查找/加载主类。我无法找到确切的错误是什么。请帮我解决这个问题。

提前致谢。

错误:

[ERROR] Failed to execute goal on project Test: Could not resolve dependencies for project com.mavenProject:Test:jar:0.0.1-SNAPSHOT: Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:jar:2.8.9 from/to prod (https://ci-repo.aexp.com/java-proxy/content/repositories/prod/): Access denied to https://ci-repo.aexp.com/java-proxy/content/repositories/prod/com/fasterxml/jackson/core/jackson-databind/2.8.9/jackson-databind-2.8.9.jar. Error code 403, Requested item is quarantined -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

pom.hml

<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.mavenProject</groupId>
  <artifactId>Test</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.6.RELEASE</version>
     </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.9</version>
        </dependency>

    </dependencies>


</project>

主类:

@SpringBootApplication
public class ProxyReportController {
    public static void main(String[] args) 
    {
        SpringApplication.run(com.aexp.grt.datacomp.proxy.controller.ProxyReportController.class, args);
        InputStream inputStream;
        try {
            inputStream = new FileInputStream("C:\\Users\\pdaga4\\Desktop\\Files\\report_sample_match_2018-10-19-230920.xls");
            try {
                Workbook wb1 = WorkbookFactory.create(inputStream);

                Sheet sheet = wb1.getSheetAt(0);// getting sheet at 0
                System.out.println("Sheet name is:>>>>"+sheet.getSheetName());

                Row row1 = sheet.getRow(0);
                Iterator cellIter=row1.cellIterator();

                while(cellIter.hasNext()){
                    System.out.println(cellIter.next());
                }
            } catch (InvalidFormatException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

}
java maven
3个回答
0
投票

在url maven用于检索jackson-databind工件之后,我假设您正在使用镜像。

尝试在settings.xml中注释掉任何镜像标记。您可以在计算机上的以下某个位置找到settings.xml文件:

$ {} maven.home /conf/settings.xml $ {}的user.home /。平方米/ settings.xml中


0
投票

在settings.xml中更新镜像的凭据

<servers>
...
        <server>
            <id>MY-REPO</id>
            <username>MYREPO-USER</username>
            <password>MYREPO-PASS</password>
        </server>
</servers>

<mirrors>
        <mirror>
            <id>MY-REPO</id>
            <mirrorOf>central</mirrorOf>
            <name>Mirror </name>
            <url>https://ci-repo.aexp.com/java-proxy/content/repositories/prod/</url>
        </mirror>
...
<mirrors>

在此示例中,MY-REPO是ci-repo.aexp.com镜像的ID,凭据与用于在Web浏览器中打开https://ci-repo.aexp.com/java-proxy/content/repositories/prod/的凭据相同


0
投票

我面临着类似的问题。我通过更改IDE中的某些配置解决了这个问题。我使用WebSphere(由Eclipse技术提供支持)。我希望以下步骤也可以帮到你。

在IDE中,请单击Window> Preferences> Java EE> Maven> Maven Repository Initialization。如果settings.xml文件不存在,该页面将显示以下文本:settings.xml文件不存在。要创建此文件并配置IBM Maven存储库,请单击“配置”。此操作在settings.xml文件中配置IBM Maven存储库,并注册原型目录的URL。

settings.xml文件的位置由Window> Preferences> Maven> User Settings页面中设置的值确定。 (如果需要:要更改文件位置,请单击“用户设置文件”链接以直接转到首选项页面。)

此外,在创建新工作区时,默认情况下会关闭Maven存储库索引。请单击窗口>首选项> Maven,然后选择在启动时下载存储库索引更新。

希望这可以帮助!

© www.soinside.com 2019 - 2024. All rights reserved.