无法建立Maven专案

时间:2019-02-07 14:50:45

标签: java maven

嗨,我是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.xml

<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();
        }

    }

}

3 个答案:

答案 0 :(得分:0)

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

尝试注释掉settings.xml中的任何镜子标签。 您可以在计算机上以下位置之一找到settings.xml文件:

$ {maven.home} /conf/settings.xml
$ {user.home} /。m2 / settings.xml

答案 1 :(得分: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 凭据与您在网络浏览器中打开https://ci-repo.aexp.com/java-proxy/content/repositories/prod/所使用的凭据相同

答案 2 :(得分:0)

我面临类似的问题。我通过在IDE中更改一些配置来解决它。我使用WebSphere(由Eclipse技术提供支持)。我希望以下步骤也能对您有所帮助。

在IDE中, 请单击窗口>首选项> Java EE> Maven> Maven存储库初始化。如果settings.xml文件不存在,则页面将显示以下文本:settings.xml文件不存在。要创建此文件并配置IBM Maven存储库,请单击配置。此操作在settings.xml文件中配置IBM Maven存储库,并注册原型目录的URL。

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

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

希望这会有所帮助!