我正在尝试生成一个 jar,以便我可以将其用作不同项目的依赖项。在 build.gradle 中,我定义了 maven-publish id 和发布任务,但只生成以下文件 - 但我需要custom-codegen-0.0.1-SNAPSHOT.jar
custom-codegen-0.0.1-SNAPSHOT-plain.jar
custom-codegen-0.0.1-SNAPSHOT.module
custom-codegen-0.0.1-SNAPSHOT.pom
maven-metadata-local.xml
Run Code Online (Sandbox Code Playgroud)
构建.gradle
plugins {
id 'org.springframework.boot' version '2.5.6'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'maven-publish'
}
group = 'com.tmo5'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
}
}
repositories {
maven {
def …Run Code Online (Sandbox Code Playgroud) 我需要逐行搜索文件中的两个特定单词,如果它们存在,则打印"Found!".
这是file.txt(有四列)
bill gates 62bill microsoft
beyonce knowles 300mill entertainment
my name -$9000 student
Run Code Online (Sandbox Code Playgroud)
以下是我的想法,但它似乎不起作用
char firstname[];
char lastname[];
char string_0[256];
file = fopen("file.txt","r+");
while((fgets(string_0,256,file)) != NULL) {
//scans the line then sets 1st and 2nd word to those variables
fscanf(file,"%s %s",&firstname, &lastname);
if(strcmp(firstname,"beyonce")==0 && strcmp(lastname,"knowles")==0){
printf("A match has been found");
}
}
fclose(file);
Run Code Online (Sandbox Code Playgroud)
请帮忙.可能是指针没有移动到while循环中的下一行吗?如果是这样,我该如何解决?
我手上有两难.经过多次试验和错误,我仍然无法弄清楚这个简单的任务.
我有一个阵列
String [] array = {anps, anps, anps, bbo, ehllo};
Run Code Online (Sandbox Code Playgroud)
我需要能够遍历数组并找到重复项并在同一行上打印它们.应该单独显示没有重复的单词
输出需要像这样
anps anps anps
bbo
ehllo
Run Code Online (Sandbox Code Playgroud)
我试过while,for循环,但逻辑似乎不可能.
我是unix的初学者,我刚陷入困境.我正在处理的bash应用程序非常简单,可以添加联系人,删除联系人(基于名字和姓氏).下面是我的代码的一部分,由于某种原因,grep在排除(> contacts_file)时显示剩余的联系人,但在包含(> contacts_file)时不保存到文件.它将'contacts_file'留空.我怎样才能解决这个问题?或者有更好的方法来搜索联系人文件中的联系人吗?contacts_file中的格式为:firstname lastname
echo "[Remove a contact]"
echo "First Name: "
read first0
echo "Last Name: "
read last0
grep -vw -e "$first0 $last0" contacts_file >contacts_file
Run Code Online (Sandbox Code Playgroud)