将Maven依赖项导入Java项目

时间:2018-10-17 14:55:08

标签: java maven netbeans

我正在按照《快速入门》指南学习Java的新框架(the documentation),并尝试通过Maven导入(我也不熟悉):

当我将依赖项添加到Netbeans时,它们会出现,但是快速入门指南指示使用的pom.xml主类是不可导入的:

Blade

如何从Maven依赖项列表中导入类文件?

这里只是看看<?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>

print(result.group(0))

1 个答案:

答案 0 :(得分:1)

您仅添加了“ 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>