简体   繁体   English

将Maven依赖项导入Java项目

[英]Import Maven dependancies into Java project

I am trying to learn a new framework ( Blade ) for Java, following the Quick Start guide, and trying to import with Maven (which I am also unfamiliar with): 我正在尝试按照快速入门指南学习Java的新框架( Blade ),并尝试使用Maven导入(我也不熟悉):

When I add the dependencies to Netbeans, they show up but the main class that the Quick Start guide instructs to use com.blade.Blade is unimportable: 当我将依赖项添加到Netbeans时,它们会显示出来,但是快速入门指南指示使用com.blade.Blade的主类是不重要的:

在此处输入图片说明

How do I import the class file from the Maven dependencies list? 如何从Maven依赖项列表中导入类文件?

Here's a look at the pom.xml just incase: 这里只是看一下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>com.bladejava</groupId>
    <artifactId>blade-mvc</artifactId>
    <version>2.0.11.BETA</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>com.bladejava</groupId>
            <artifactId>blade-mvc</artifactId>
            <version>2.0.11.BETA</version>
            <type>jar</type>
        </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
</project>

You added just "blade-mvc" dependency, I think you try to add "blade-core": 您仅添加了“ blade-mvc”依赖项,我认为您尝试添加“ blade-core”:

<?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>com.bladejava</groupId>
    <artifactId>blade-mvc</artifactId>
    <version>2.0.11.BETA</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>com.bladejava</groupId>
            <artifactId>blade-mvc</artifactId>
            <version>2.0.11.BETA</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>com.bladejava</groupId>
            <artifactId>blade-core</artifactId>
            <version>1.7.2-beta</version>
        </dependency>

    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
</project>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM