Java 在没有Eclipse的情况下运行项目
在我的公司,很多团队(包括我的团队)都不知道如何在没有Eclipse的情况下运行Spring项目,以至于这已经成为一个问题。我已经广泛地搜索了很多东西,但是在一些地方我绊倒了,只是说“PressRun”就可以运行这个项目。很多时候,这并不能帮助我们理解遗留项目的依赖关系,当然,遗留项目没有现成的文档,或者设计它的人(或者设计它的人不知道如何在没有IDE的情况下运行它) 以下是最新版本的体系结构: Spring、Gradle、Java 我尝试使用Java 在没有Eclipse的情况下运行项目,java,spring,eclipse,spring-boot,gradle,Java,Spring,Eclipse,Spring Boot,Gradle,在我的公司,很多团队(包括我的团队)都不知道如何在没有Eclipse的情况下运行Spring项目,以至于这已经成为一个问题。我已经广泛地搜索了很多东西,但是在一些地方我绊倒了,只是说“PressRun”就可以运行这个项目。很多时候,这并不能帮助我们理解遗留项目的依赖关系,当然,遗留项目没有现成的文档,或者设计它的人(或者设计它的人不知道如何在没有IDE的情况下运行它) 以下是最新版本的体系结构: Spring、Gradle、Java 我尝试使用/gradlew run运行此项目,但是任务运行似乎
/gradlew run
运行此项目,但是任务运行似乎不应该运行应用程序,任务甚至不存在,并且build.gradle
文件中没有它
这是build.gradle
文件:
plugins {
id 'org.springframework.boot' version '2.1.6.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
group = 'com.name'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-actuator'
compileOnly 'org.projectlombok:lombok:1.18.4'
}
这是假定为运行程序的Java文件:
package com.company.authApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class AuthApplication {
public static void main(String[] args) {
SpringApplication.run(AuthApplication.class, args);
}
}
即使build.gradle
文件提到mavenCentral()
,这根本不是为Maven构建的,这只是它的默认结构
非常感谢您的帮助。/code>/gradlew bootRun?您也可以尝试生成jar。您是否查看了
/gradlew tasks
?谢谢!这实际上启动了Spring,但失败了。我会继续检查的。使用gradle构建jar/war,并使用“java-jar.jar/.war”运行。是的,使用gradle构建jar也很困难。“如果我还发现了什么,我会和你分享的,谢谢,@maxplode。”。