如何使用Gradle使用Eclipse导入软件包?

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

如何解决Eclipse 10行 import org.basex.core.BaseXException;的类路径红色错误:

red_errors

已导入导入为:

import

在控制台上创建后:

thufir@dur:~/eclipse-workspace/gradleProject$ 
thufir@dur:~/eclipse-workspace/gradleProject$ gradle init --type java-application --test-framework testng
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details

Select build script DSL:
  1: groovy
  2: kotlin
Enter selection (default: groovy) [1..2] 1

Project name (default: gradleProject): 
Source package (default: gradleProject): 

BUILD SUCCESSFUL in 42s
2 actionable tasks: 2 executed
thufir@dur:~/eclipse-workspace/gradleProject$ 

生成的gradle构建文件,我只添加了basex编译组:

/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java project to get you started.
 * For more details take a look at the Java Quickstart chapter in the Gradle
 * User Manual available at https://docs.gradle.org/5.4.1/userguide/tutorial_java_projects.html
 */

plugins {
    // Apply the java plugin to add support for Java
    id 'java'

    // Apply the application plugin to add support for building an application
    id 'application'
}

repositories {
    // Use jcenter for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
}

dependencies {
    // This dependency is found on compile classpath of this component and consumers.
    implementation 'com.google.guava:guava:27.0.1-jre'

    compile group: 'org.basex', name: 'basex', version: '9.2.4'

    // Use TestNG framework, also requires calling test.useTestNG() below
    testImplementation 'org.testng:testng:6.14.3'
}

// Define the main class for the application
mainClassName = 'gradleProject.App'

test {
    // Use TestNG for unit tests
    useTestNG()
}

gradle plugininstalled,并且就其价值而言,gradle从控制台成功运行了项目:

thufir@dur:~/eclipse-workspace/gradleProject$ 
thufir@dur:~/eclipse-workspace/gradleProject$ gradle clean run

> Task :run
Oct. 11, 2019 3:30:31 P.M. gradleProject.App loadProperties
INFO: {databasePath=src/main/resources/treasury.xml, xmlFromUrl=https://www.treasurydirect.gov/xml/A_20080410_1.xml, databaseName=treasury}
Oct. 11, 2019 3:30:31 P.M. gradleProject.App loadProperties
INFO: Name      Resources  Size   Input Path                                                                    
--------------------------------------------------------------------------------------------------------
treasury  1          12024  /home/thufir/eclipse-workspace/gradleProject/src/main/resources/treasury.xml  

1 database(s).

Oct. 11, 2019 3:30:32 P.M. gradleProject.App loadProperties
INFO: Name      Resources  Size   Input Path                                                                    
--------------------------------------------------------------------------------------------------------
treasury  1          12024  /home/thufir/eclipse-workspace/gradleProject/src/main/resources/treasury.xml  

1 database(s).


BUILD SUCCESSFUL in 1s
4 actionable tasks: 4 executed
thufir@dur:~/eclipse-workspace/gradleProject$ 
eclipse gradle import build.gradle classpath
1个回答
0
投票

我支持财政部,目前正在帮助支持一些用户体验研究,以更好地了解谁在使用我们当前的网站,以及我们如何通过新的数据站点计划来改善他们的体验。您在这里发布的帖子已发送给我,因为您是有人提到我们的网站之一。我想知道您是否有几分钟的时间来讨论如何找到它,正在尝试完成什么任务,以及听到有关您使用该网站的经验(特别是如果有一些事情我们可以做得更好呢!)有几分钟的聊天时间!

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