Символ не найден/доступен из другого подпроекта Gradle, модульная JavaJAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Символ не найден/доступен из другого подпроекта Gradle, модульная Java

Сообщение Anonymous »

Я создаю пару модульных Java-проектов и настраиваю их как подпроекты Gradle. Они оба модульные Java, и я хочу, чтобы один (linrboot) ссылался на класс в другом (linr), но VSCode говорит, что он недоступен, пока сборка не удалась, потому что он не может найти символ. Я уверен, что мне не хватает чего-то элементарного.
Структура файла

Код: Выделить всё

.
| settings.gradle
| gradlew
| linrboot
| | build.gradle
| | bin
| | build
| | src
| linr
| | build.gradle
| | bin
| | build
| | src
settings.gradle

Код: Выделить всё

plugins {
// Apply the foojay-resolver plugin to allow automatic download of JDKs
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}

rootProject.name = 'linr'
include'linr', 'linrboot'

linrboot build.gradle

Код: Выделить всё

import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

plugins {
id 'java-library'
id 'application'
id 'org.javamodularity.moduleplugin' version '1.8.9'
id 'org.beryx.jlink' version '3.0.1'
id 'org.openjfx.javafxplugin' version '0.1.0'
}

repositories {
mavenCentral()
}

javafx {
version = '22.0.1'
configuration = 'implementation'
modules = ['javafx.base', 'javafx.controls', 'javafx.fxml', 'javafx.media', 'javafx.swing']
}

dependencies {
implementation 'org.apache.pdfbox:pdfbox:3.0.2'
implementation 'com.jfoenix:jfoenix:9.0.10'
implementation 'org.apache.commons:commons-text:1.12.0'
implementation 'org.apache.commons:commons-lang3:3.16.0'
implementation 'jakarta.mail:jakarta.mail-api:2.1.3'
implementation 'org.eclipse.angus:angus-mail:2.0.3'
implementation 'org.update4j:update4j:1.5.9'
implementation project(':linr')
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

test {
useJUnit()
}

application {
mainModule = "com.dittmer.linrboot"
mainClass = "com.dittmer.linrboot.App"
}
linrboot Module-info.java

Код: Выделить всё

module com.dittmer.linrboot
{
requires java.base;

requires javafx.swing;
requires javafx.fxml;
requires javafx.base;
requires transitive javafx.controls;
requires javafx.graphics;
requires org.update4j;

requires com.dittmer.linr;

exports com.dittmer.linrboot;

}

linr build.gradle

Код: Выделить всё

import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

plugins {
id 'java-library'
id 'application'
id 'org.javamodularity.moduleplugin' version '1.8.9'
id 'org.beryx.jlink' version '3.0.1'
id 'org.openjfx.javafxplugin' version '0.1.0'
}

repositories {
mavenCentral()
}

javafx {
version = '22.0.1'
configuration = 'implementation'
modules = ['javafx.base', 'javafx.controls', 'javafx.fxml', 'javafx.media', 'javafx.swing']
}

dependencies {

implementation 'org.apache.pdfbox:pdfbox:3.0.2'
implementation 'com.jfoenix:jfoenix:9.0.10'
implementation 'org.apache.commons:commons-text:1.12.0'
implementation 'org.apache.commons:commons-lang3:3.16.0'
implementation 'jakarta.mail:jakarta.mail-api:2.1.3'
implementation 'org.eclipse.angus:angus-mail:2.0.3'
implementation 'org.update4j:update4j:1.5.9'
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

def currentOS = DefaultNativePlatform.currentOperatingSystem
version = "1.0"

jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
launcher {
name = 'Linr'
}
forceMerge('log4j-api')
if (currentOS.isWindows()) {
jpackage {
installerType = 'msi'
icon = "${project.rootDir}/src/main/resources/com/dittmer/linr/icons/linr.ico"
installerOptions = [
'--win-menu',
'--win-menu-group', 'DittmerLabs',
'--win-shortcut-prompt',
'--win-upgrade-uuid', '52910e5b-eb4c-4d58-b892-a2679656861c',
'--win-dir-chooser',
'--copyright', 'Copyright (c) 2024 DittmerLab',
'--description', 'Linr is a new way of taking line notes for theatrical productions.',
'--vendor', 'DittmerLabs',
'--license-file', 'LICENSE.md',
'--app-version', "${project.version.toString()}",
'--about-url',  'https://github.com/DittmerK',
]
}
} else if (currentOS.isLinux()) {
jpackage {
installerType = 'rpm'
icon = "${project.rootDir}/src/main/resources/com/dittmer/linr/icons/Linr.png"
installerOptions = [
'--linux-shortcut',
'--linux-package-name', 'com.dittmer.linr',
'--linux-rpm-license-type', 'AGPL',
'--copyright', 'Copyright (c) 2024 DittmerLabs',
'--description', 'Linr is a new way of taking line notes for theatrical productions.',
'--vendor', 'DittmerLabs',
'--license-file', 'LICENSE.md',
'--app-version', "${project.version.toString()}",
'--about-url', 'https://github.com/DittmerK/'
]
}
} else if (currentOS.isMacOsX()) {
jpackage {
installerType = 'dmg'
icon = "${project.rootDir}/src/main/resources/com/dittmer/linr/icons/Linr.png"
installerOptions = [
'--mac-package-name', 'Linr',
'--mac-package-identifier', 'com.dittmer.linr',
'--mac-app-category', 'public.app-category.music',
'--copyright', 'Copyright (c) 2024 DittmerLabs',
'--description', 'Linr is a new way of taking line notes for theatrical productions.',
'--vendor', 'DittmerLabs',
'--license-file', 'LICENSE.md',
'--app-version', "${project.version.toString()}",
'--about-url', 'https://github.com/DittmerK/'
]
}
}
}

test {
useJUnit()
}

application {
mainModule = "com.dittmer.linr"
mainClass = "com.dittmer.linr.App"
}
linr Module-info.java

Код: Выделить всё

module com.dittmer.linr
{
requires java.base;

requires javafx.swing;
requires javafx.fxml;
requires javafx.base;
requires jakarta.mail;
requires org.eclipse.angus.mail;
requires transitive javafx.controls;
requires transitive com.jfoenix;
requires transitive org.apache.pdfbox;
requires org.apache.commons.text;
requires org.apache.commons.lang3;
requires javafx.graphics;

exports com.dittmer.linr;
}
Я ожидаю, что символ будет видимым и доступным. Я просмотрел другие сообщения на форуме и документацию Gradle, и вроде все в порядке?

Подробнее здесь: https://stackoverflow.com/questions/790 ... dular-java
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «JAVA»