Cannot resolve symbol 'PixM' when trying to import my java gradle library in a demo project
已回答
Hello,
I'm developing this library: https://repo.maven.apache.org/maven2/one/empty3/empty3-library-generic/
I've created a blank gradle project to test it with adding its dependency to gradle and copy a test file:
plugins {
id 'java'
}
group = 'one.empty3'
version = '1.0-SNAPSHOT'
sourceSets {
}
repositories {
google()
mavenCentral()
maven {
url = uri("https://repo.maven.apache.org/maven2/")
}
maven {
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
maven {
url = uri("https://repository.sonatype.org/content/groups/public/")
}
/*maven {
url = uri("https://maven.scijava.org/content/repositories/public/")
}*/
/* maven {
url "https://maven.jzy3d.org/releases/"
}*/
maven {
url "https://www.jetbrains.com/intellij-repository/releases"
}
maven {
url = uri("https://mvnrepository.com/")
}
flatDir dirs: "${rootDir}/lib"
}
dependencies {
implementation("one.empty3:empty3-library-generic:2023.4")
testImplementation platform('org.junit:junit-bom:5.9.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
}
test {
useJUnitPlatform()
}
sourceSets {
main {
java {
srcDirs 'src/main/java'
}
resources {
srcDirs "src/main/resources", "src/main/java", "src/test/resources"
}
}
}
tasks.register("runMain", JavaExec) {
classpath sourceSets.main.runtimeClasspath
mainClass = "one.empty3.Main"
args "arg1", "arg2"
dependsOn(jar)
}
tasks.register("runTestSunset", JavaExec) {
classpath sourceSets.main.runtimeClasspath
mainClass = "one.empty3.sampleapp.tests.Sunset"
args "arg1", "arg2"
dependsOn(jar)
}
id 'java'
}
group = 'one.empty3'
version = '1.0-SNAPSHOT'
sourceSets {
}
repositories {
google()
mavenCentral()
maven {
url = uri("https://repo.maven.apache.org/maven2/")
}
maven {
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
maven {
url = uri("https://repository.sonatype.org/content/groups/public/")
}
/*maven {
url = uri("https://maven.scijava.org/content/repositories/public/")
}*/
/* maven {
url "https://maven.jzy3d.org/releases/"
}*/
maven {
url "https://www.jetbrains.com/intellij-repository/releases"
}
maven {
url = uri("https://mvnrepository.com/")
}
flatDir dirs: "${rootDir}/lib"
}
dependencies {
implementation("one.empty3:empty3-library-generic:2023.4")
testImplementation platform('org.junit:junit-bom:5.9.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
}
test {
useJUnitPlatform()
}
sourceSets {
main {
java {
srcDirs 'src/main/java'
}
resources {
srcDirs "src/main/resources", "src/main/java", "src/test/resources"
}
}
}
tasks.register("runMain", JavaExec) {
classpath sourceSets.main.runtimeClasspath
mainClass = "one.empty3.Main"
args "arg1", "arg2"
dependsOn(jar)
}
tasks.register("runTestSunset", JavaExec) {
classpath sourceSets.main.runtimeClasspath
mainClass = "one.empty3.sampleapp.tests.Sunset"
args "arg1", "arg2"
dependsOn(jar)
}
/*
* Copyright (c) 2023. Manuel Daniel Dahmen
*
*
* Copyright 2012-2023 Manuel Daniel Dahmen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package one.empty3.sampleapp.tests;
import one.empty3.feature.PixM;
import one.empty3.feature.app.replace.javax.imageio.ImageIO;
import one.empty3.library.*;
import one.empty3.library.core.extra.VoronoiImageTexture;
import one.empty3.library.core.testing.TestObjetSub;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
public class Sunset extends TestObjetSub {
private static final int VUE_1 = 30;
private static final int FPS = 50;
Plane polygon = new Plane();
Plane polygon1 = new Plane();
public static void main(String[] args) {
Sunset sunset = new Sunset();
sunset.loop(true);
sunset.setMaxFrames(VUE_1*FPS);
new Thread(sunset).start();
}
@Override
public void ginit() {
super.ginit();
BufferedImage read = ImageIO.read(new File("resources/dup12138.jpg"));
VoronoiImageTexture voronoiImageTexture = new VoronoiImageTexture();
PixM image = voronoiImageTexture.processInMemory(new PixM(read));
try {
polygon1.texture(new ImageTexture(new ECBufferedImage(image.getImage())));
} catch (Exception ex) {
ex.printStackTrace();
}
}
@Override
public void finit() throws Exception {
super.finit();
if (frame() < VUE_1 * FPS) {
//z().setDisplayType(Representable.DISPLAY_ALL);
z().texture(new ColorTexture(Color.BLACK));
Plane polygon = new Plane();
Plane polygon1 = new Plane();
StructureMatrix<Point3D> mat = new StructureMatrix<>(2, Point.class);
mat.setElem(new Point3D(-10d, 0d, -10d), 0, 0);
mat.setElem(new Point3D(10d, 0d, -10d), 1, 0);
mat.setElem(new Point3D(10d, 0d, 10d), 1, 1);
mat.setElem(new Point3D(-10d, 0d, 10d), 0, 1);
/*polygon.setMatrix( new Point3D[][]{
{mat.getElem(0, 0), mat.getElem(1, 0)}, {mat.getElem(1, 0), mat.getElem(1, 1)}
});*/
scene().clear();
/*
polygon.setPoints(
new Point3D[]{
mat.getElem(0, 0), mat.getElem(1, 0), mat.getElem(1, 1), mat.getElem(0, 1)
});
polygon.setP0(mat.getElem(0, 0));
polygon1.setPoints(
new Point3D[]{
mat.getElem(0, 0).plus(Point3D.Y), mat.getElem(1, 0).plus(Point3D.Y),
mat.getElem(1, 1).plus(Point3D.Y), mat.getElem(0, 1).plus(Point3D.Y)
});
*/
Point3D[] vects = new Point3D[]{mat.getElem(0, 0), mat.getElem(0, 1), mat.getElem(1, 0)};
StructureMatrix<Point3D>[] v = new StructureMatrix[] {
new StructureMatrix<Point3D>(0, Point3D.class),
new StructureMatrix<Point3D>(0, Point3D.class),
new StructureMatrix<Point3D>(0, Point3D.class)};
v[0].setElem(vects[0]);
v[1].setElem(vects[1]);
v[2].setElem(vects[2]);
polygon.setP0(v[0]);
polygon.setvX(v[1]);
polygon.setvY(v[2]);
polygon.texture(new ColorTexture(new Color(0f, 0.2f, 1.0f)));
StructureMatrix<Point3D>[] v1 = new StructureMatrix[] {
new StructureMatrix<Point3D>(0, Point3D.class),
new StructureMatrix<Point3D>(0, Point3D.class),
new StructureMatrix<Point3D>(0, Point3D.class)};
v1[0].setElem(vects[0].plus(Point3D.Y));
v1[1].setElem(vects[1].plus(Point3D.Y));
v1[2].setElem(vects[2].plus(Point3D.Y));
polygon1.setP0(v1[0]);
polygon1.setvX(v1[1]);
polygon1.setvY(v1[2]);
polygon.setIncrU(0.003);
polygon.setIncrU(0.003);
polygon1.setIncrV(0.003);
polygon1.setIncrV(0.003);
scene().add(polygon);
scene().add(polygon1);
Point3D eye = new Point3D(5.0, 0.2, 5.0);
Point3D lookAt = new Point3D(-5.0, 0.2, 5.0);
Point3D pos = eye.plus(lookAt.moins(eye).mult(1.0*frame() / (FPS * VUE_1)));
Camera camera = new Camera(pos, lookAt, Point3D.Y);
camera.calculerMatrice(Point3D.Y);
scene().cameraActive(camera);
}
}
}
* Copyright (c) 2023. Manuel Daniel Dahmen
*
*
* Copyright 2012-2023 Manuel Daniel Dahmen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package one.empty3.sampleapp.tests;
import one.empty3.feature.PixM;
import one.empty3.feature.app.replace.javax.imageio.ImageIO;
import one.empty3.library.*;
import one.empty3.library.core.extra.VoronoiImageTexture;
import one.empty3.library.core.testing.TestObjetSub;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
public class Sunset extends TestObjetSub {
private static final int VUE_1 = 30;
private static final int FPS = 50;
Plane polygon = new Plane();
Plane polygon1 = new Plane();
public static void main(String[] args) {
Sunset sunset = new Sunset();
sunset.loop(true);
sunset.setMaxFrames(VUE_1*FPS);
new Thread(sunset).start();
}
@Override
public void ginit() {
super.ginit();
BufferedImage read = ImageIO.read(new File("resources/dup12138.jpg"));
VoronoiImageTexture voronoiImageTexture = new VoronoiImageTexture();
PixM image = voronoiImageTexture.processInMemory(new PixM(read));
try {
polygon1.texture(new ImageTexture(new ECBufferedImage(image.getImage())));
} catch (Exception ex) {
ex.printStackTrace();
}
}
@Override
public void finit() throws Exception {
super.finit();
if (frame() < VUE_1 * FPS) {
//z().setDisplayType(Representable.DISPLAY_ALL);
z().texture(new ColorTexture(Color.BLACK));
Plane polygon = new Plane();
Plane polygon1 = new Plane();
StructureMatrix<Point3D> mat = new StructureMatrix<>(2, Point.class);
mat.setElem(new Point3D(-10d, 0d, -10d), 0, 0);
mat.setElem(new Point3D(10d, 0d, -10d), 1, 0);
mat.setElem(new Point3D(10d, 0d, 10d), 1, 1);
mat.setElem(new Point3D(-10d, 0d, 10d), 0, 1);
/*polygon.setMatrix( new Point3D[][]{
{mat.getElem(0, 0), mat.getElem(1, 0)}, {mat.getElem(1, 0), mat.getElem(1, 1)}
});*/
scene().clear();
/*
polygon.setPoints(
new Point3D[]{
mat.getElem(0, 0), mat.getElem(1, 0), mat.getElem(1, 1), mat.getElem(0, 1)
});
polygon.setP0(mat.getElem(0, 0));
polygon1.setPoints(
new Point3D[]{
mat.getElem(0, 0).plus(Point3D.Y), mat.getElem(1, 0).plus(Point3D.Y),
mat.getElem(1, 1).plus(Point3D.Y), mat.getElem(0, 1).plus(Point3D.Y)
});
*/
Point3D[] vects = new Point3D[]{mat.getElem(0, 0), mat.getElem(0, 1), mat.getElem(1, 0)};
StructureMatrix<Point3D>[] v = new StructureMatrix[] {
new StructureMatrix<Point3D>(0, Point3D.class),
new StructureMatrix<Point3D>(0, Point3D.class),
new StructureMatrix<Point3D>(0, Point3D.class)};
v[0].setElem(vects[0]);
v[1].setElem(vects[1]);
v[2].setElem(vects[2]);
polygon.setP0(v[0]);
polygon.setvX(v[1]);
polygon.setvY(v[2]);
polygon.texture(new ColorTexture(new Color(0f, 0.2f, 1.0f)));
StructureMatrix<Point3D>[] v1 = new StructureMatrix[] {
new StructureMatrix<Point3D>(0, Point3D.class),
new StructureMatrix<Point3D>(0, Point3D.class),
new StructureMatrix<Point3D>(0, Point3D.class)};
v1[0].setElem(vects[0].plus(Point3D.Y));
v1[1].setElem(vects[1].plus(Point3D.Y));
v1[2].setElem(vects[2].plus(Point3D.Y));
polygon1.setP0(v1[0]);
polygon1.setvX(v1[1]);
polygon1.setvY(v1[2]);
polygon.setIncrU(0.003);
polygon.setIncrU(0.003);
polygon1.setIncrV(0.003);
polygon1.setIncrV(0.003);
scene().add(polygon);
scene().add(polygon1);
Point3D eye = new Point3D(5.0, 0.2, 5.0);
Point3D lookAt = new Point3D(-5.0, 0.2, 5.0);
Point3D pos = eye.plus(lookAt.moins(eye).mult(1.0*frame() / (FPS * VUE_1)));
Camera camera = new Camera(pos, lookAt, Point3D.Y);
camera.calculerMatrice(Point3D.Y);
scene().cameraActive(camera);
}
}
}
Can you help me?
请先登录再写评论。
Now, I see there is no .class file in empty3-library-generic 2023.4 there is javadoc.
What's wrong in https://github.com/manuelddahmen/empty3_miror/ ?
It looks like you are trying to import .html files into a java class: https://i.imgur.com/6Ts1C8N.png
This is not supported. Import keyword can be used to import a java package, class or interface.
If you try to import entire package, for example:
It will not report an error, but you still wouldn't be able to use the files in this package as they are not java classes.
Yes, that's it. I think I made a mistake in my imported library, in the build.gradle file
plugins {
id("application") // enabling the plugin here
id("java")
id 'java-library'
id 'maven-publish'
id 'signing'
//id 'org.jetbrains.kotlin.jvm' version '1.8.10'
id 'org.jetbrains.kotlin.multiplatform' version '1.8.10'
}
sourceSets {
main {
resources {
srcDirs "src/main/resources", "src/main/configs", "src/main/java"
}
}
commonTest {
}
}
kotlin {
//macosX64('native') { // on macOS
// linuxX64('native') // on Linux
mingwX64('native') // on Windows
// binaries {
// executable()
// }
}
Properties properties = new Properties()
try {
// Other configuration here
File propertiesFile = new File('../private.properties/gradle.properties')
propertiesFile.withInputStream {
properties.load(it)
}
} catch (Exception ex) {
ex.printStackTrace()
}
tasks.register('copyDeps', Copy) {
//from(configurations.compile + configurations.testCompile) {
include ".jar"
include ".so", "*.dll"
//}
}
def load = properties
java {
withSourcesJar()
}
tasks.register('FeatureAppGui', JavaExec) {
classpath sourceSets.main.runtimeClasspath
mainClass = "one.empty3.feature.ClassSchemaBuilder"
args "arg1", "arg2"
}
tasks.register('MorphingAppGui', JavaExec) {
classpath sourceSets.main.runtimeClasspath
mainClass = "one.empty3.apps.morph.Main"
args "arg1", "arg2"
}
tasks.register('OpadGameGui', JavaExec) {
classpath sourceSets.main.runtimeClasspath
mainClass = "one.empty3.apps.opad.PanelGraphics"
}
tasks.register('BoardGameGui', JavaExec) {
classpath sourceSets.main.runtimeClasspath
mainClass = "one.empty3.apps.newboardgames.WindowDrawing"
args "arg1", "arg2"
}
tasks.register('ResolutionCharacter8', JavaExec) {
classpath sourceSets.main.runtimeClasspath
mainClass= "one.empty3.feature.tryocr.ResolutionCharacter8"
args "arg1", "arg2"
}
tasks.register('OCR', JavaExec) {
classpath sourceSets.main.runtimeClasspath
mainClass= "one.empty3.feature.tryocr.OCR1"
args "arg1", "arg2"
dependsOn(jar)
}
tasks.register('RunEffect from sets directory', JavaExec) {
classpath sourceSets.main.runtimeClasspath
mainClass = "one.empty3.feature.Run"
args "fourier_series"
}
signing {
def signingKey = load.get("signing.keyId")
def signingPassword = load.get("signing.password")
useGpgCmd()
//useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications
sign configurations.archives
}
repositories {
google()
mavenCentral()
maven {
url = uri("https://repo.maven.apache.org/maven2/")
}
maven {
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
maven {
url = uri("https://repository.sonatype.org/content/groups/public/")
}
maven {
url = uri("https://mvnrepository.com/")
}
maven {
url = uri("https://maven.scijava.org/content/repositories/public/")
}
maven {
url "https://maven.jzy3d.org/releases/"
}
maven {
url "https://www.jetbrains.com/intellij-repository/releases"
}
flatDir dirs: "${rootDir}/lib"
}
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
dependencies {
implementation 'org.junit.jupiter:junit-jupiter:5.8.1'
implementation 'junit:junit:4.13.1'
testImplementation project(path: ':')
testImplementation 'junit:junit:4.13.1'
testImplementation 'junit:junit:3.8.2'
/*implementation("com.metsci.ext.org.jogamp.gluegen:gluegen-rt:v2.4.0-rc4")
implementation("com.metsci.ext.org.jogamp.jogl:jogl-all:v2.4.0-rc4")
implementation "com.metsci.ext.org.jogamp.gluegen:gluegen-rt:2.4.0-rc-20200202:natives-windows-amd64"
implementation "com.metsci.ext.org.jogamp.jogl:jogl-all:2.4.0-rc-20200202:natives-windows-amd64"
*/
//implementation('org.tensorflow:tensorflow-core-platform:0.4.1')
//implementation 'org.tensorflow:tensorflow-core-api:0.4.1:windows-x86_64${javacpp.platform.extension}'
def jogl = '2.3.2'
implementation "org.jogamp.jogl:jogl-all:$jogl"
implementation group: 'org.jogamp.gluegen', name: 'gluegen-rt-main', version:"$jogl"
implementation group: 'org.jogamp.jogl', name: 'jogl-all-main', version:"$jogl"
implementation 'ai.djl:api:0.19.0'
//implementation('com.android.tools.build:gradle-api:4.0.2')
implementation("org.jcodec:jcodec-javase:0.2.5")
implementation("org.jogamp.jogl:jogl-all-main:$jogl")
implementation("com.miglayout:miglayout:3.7.4")
implementation('com.badlogicgames.gdx:gdx:1.11.0')
implementation("xom:xom:1.3.8")
implementation("com.jgoodies:jgoodies-common:1.8.2")
implementation("com.jgoodies:jgoodies-forms:1.9.0")
// https://mvnrepository.com/artifact/com.google.android/android
compileOnly group: 'com.google.android', name: 'android', version: '4.1.1.4'
implementation('xerces:xercesImpl:2.12.2')
implementation('com.formdev:flatlaf:2.6')
implementation("org.jdesktop:beansbinding:1.2.1")
implementation("com.github.sarxos:webcam-capture:0.3.12")
// https://mvnrepository.com/artifact/commons-net/commons-net
implementation group: 'commons-net', name: 'commons-net', version: '3.9.0'
implementation("org.jdom:jdom2:2.0.6.1")
implementation("org.apache.servicemix.bundles:org.apache.servicemix.bundles.jdom:2.0.6.1_1")
implementation 'com.jetbrains.intellij.java:java-gui-forms-rt:203.7148.30'
}
dependencies {
testImplementation project(path: ':')
testImplementation('org.junit.jupiter:junit-jupiter:5.5.2')
}
tasks.register('sourceJar', Jar) {
//archiveClassifier "sourcesJar"
from sourceSets.main.allJava
}
tasks.register('javadocJar', Jar) {
dependsOn javadoc
//archiveClassifier "javadoc"
from javadoc.destinationDir
}
tasks.register('copyTask', Copy) {
from 'src/main/java/'
into 'build/classes/java/main'
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
java {
withJavadocJar()
withSourcesJar()
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
publishing {
publications {
maven(MavenPublication) {
groupId = 'one.empty3'
artifactId = 'empty3-library-generic'
version = "2023.2.17"
from components.java
project.tasks.withType(Sign) {
signatures.all {
}
}
// The pom can be enriched as usual
pom {
name = 'empty3-library-generic'
description = '3D rendering engine. Plus modeling. Expected glsl textures 3d and 2d rendering'
packaging 'jar'
url = "https://github.com/manuelddahmen/empty3"
licenses {
license {
name = "Apache version 2"
url = "https://www.apache.org/licenses/LICENSE-2.0"
distribution = "repo"
}
}
scm {
url = "https://github.com/manuelddahmen/empty3"
connection = "scm:git:https://github.com/manuelddahmen/empty3.git"
developerConnection = "scm:git:https://github.com/manuelddahmen/empty3.git"
}
developers {
developer {
email = "dathewolf@gmail.com"
name = "Manuel Daniel Dahmen"
url = "https://github.com/manuelddahmen"
id = "manuelddahmen"
}
}
}
}
}
repositories {
maven {
name = "JetBrainsSpaceEmpty3"
url = "https://maven.pkg.jetbrains.space/empty3/p/empty3/maven/maven"
credentials {
// Automation has a special account for authentication in Space
// account credentials are accessible via env vars
username = load.get("spaceUsername")
password = load.get("spacePassword")
}
}
maven {
name = "OSSRH"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = load.get("ossrhUsername")
password = load.get("ossrhPassword")
}
}
/*maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/manuelddahmne/empty3")
credentials {
username = load.get("GITHUB_ACTOR")
password = load.get("GITHUB_TOKEN")
}
}*/
}
}
Yes, it looks like one.empty3:empty3-library-generic:2023.4 is not the correct library. You could check for more suitable ones in the maven repository: https://mvnrepository.com/artifact/one.empty3
I make a new release and now it works: https://central.sonatype.com/artifact/one.empty3/empty3-library-3d/2023.5.1?smo=true
https://github.com/manuelddahmen/empty3-library-generic-sampleapp
There was an error in the build.gradle, there were .hmtl (javadoc) instead of .class .