influxdata / influxdb-client-java

InfluxDB 2 JVM Based Clients
https://influxdata.github.io/influxdb-client-java/
MIT License
424 stars 129 forks source link

import com.influxdb.client.domain.WritePrecision does not work #732

Closed onelovehj closed 2 weeks ago

onelovehj commented 1 month ago

Steps to reproduce: List the minimal actions needed to reproduce the behavior.

  1. I added all the dependencies listed on README
  2. Then, import com.influxdb.client.~
  3. All other imports are working fine except com.influxdb.client.domain.WritePrecision...

Expected behavior: import com.influxdb.client.domain.WritePrecision should be working

Actual behavior: it will not import import com.influxdb.client.domain.WritePrecision

Specifications:

bednar commented 1 month ago

Hi @onelovehj,

Thank you for using our client and reaching out for support. To better understand and address the issues you're facing, could you provide more details about the problem? Specifically, it would be helpful to know:

Additionally, a working example or a small piece of code that replicates the issue would be extremely valuable. This will allow us to see the problem firsthand and provide more targeted assistance.

Looking forward to your response, and we're here to help you get the most out of our client.

Best Regards.

onelovehj commented 1 month ago

Hi @bednar

Thank you for your quick feedback and sorry for not clarifying my issue.

here is my pom.xml

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.3.0</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>influxdb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>influxdb</name>
<description>influxdb</description>
<properties>
    <java.version>17</java.version>
    <okhttp3.version>4.10.0</okhttp3.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web-services</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>com.influxdb</groupId>
        <artifactId>influxdb-client-java</artifactId>
        <version>7.1.0</version>
    </dependency>

    <dependency>
        <groupId>io.micrometer</groupId>
        <artifactId>micrometer-registry-influx</artifactId>
        <version>1.12.2</version>
    </dependency>

    <dependency>
        <groupId>com.influxdb</groupId>
        <artifactId>influxdb-spring</artifactId>
        <version>7.1.0</version>
    </dependency>

    <dependency>
        <groupId>com.influxdb</groupId>
        <artifactId>influxdb-client-flux</artifactId>
        <version>7.1.0</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-actuator-autoconfigure</artifactId>
        <version>3.3.0</version>
        <optional>true</optional>
        <exclusions>
            <exclusion>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <excludes>
                    <exclude>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                    </exclude>
                </excludes>
            </configuration>
        </plugin>
    </plugins>
</build>

This is my imports

import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import java.time.Instant; import java.util.List;

import com.influxdb.annotations.Column; import com.influxdb.annotations.Measurement; import com.influxdb.client.InfluxDBClient; import com.influxdb.client.InfluxDBClientFactory; import com.influxdb.client.QueryApi; import com.influxdb.client.WriteApiBlocking; import com.influxdb.client.domain.WritePrecision; import com.influxdb.client.write.Point; import com.influxdb.query.FluxRecord; import com.influxdb.query.FluxTable;

All of the imports are resolved fine EXCEPT "import com.influxdb.client.domain.WritePrecision;"

The message shows "Cannot resolve symbol 'WritePrecision"

I was following the instructions on README at https://github.com/influxdata/influxdb-client-java

Please let me know what else I need to provide you as I am a beginner developer.

Thank you!

bednar commented 2 weeks ago

Hi @onelovehj,

Thank you for reaching out with your issue. I've attempted to replicate your project setup based on the structure you described, and it appears to be functioning correctly on my end. This suggests that the issue may be specific to your local environment or setup.

To help further diagnose the problem, could you try compiling your project from the command line using the following Maven command? This will ensure that any environmental or IDE-specific configurations are bypassed, which could be influencing the behavior you're experiencing:

mvn clean compile

This command will clean your project's target directory and then compile the source code, which might highlight different issues or errors that are not immediately evident within your IDE.

Please let me know the outcome of this operation, including any output or errors you might encounter during the compilation process. This information will be crucial for further troubleshooting.

Best Regards

onelovehj commented 2 weeks ago

Hi @bednar

Thank you so much for your feedback. I tried what you suggested but I still have the same issue...

I asked my co-worker to try out this exact same project setup with her MAC PC (I use Windows) but she has exactly the same issue that I have.. We both used IntelliJ IDEA..

Is there anything else I can try or should I provide any info for you?

Please let me know and again, I really appreciate your feedback!

bednar commented 1 week ago

Hi @bednar

Thank you so much for your feedback. I tried what you suggested but I still have the same issue...

I asked my co-worker to try out this exact same project setup with her MAC PC (I use Windows) but she has exactly the same issue that I have.. We both used IntelliJ IDEA..

Is there anything else I can try or should I provide any info for you?

Please let me know and again, I really appreciate your feedback!

Hi,

Thank you for your cooperation as we work through these issues. To further assist with the troubleshooting process, I’ve set up a simple testing project that you can use as a reference. This project is confirmed to work successfully on MacOS with the latest version of IntelliJ IDEA.

Here’s the link to the testing project: InfluxDB Client Java Simple Example.

Could you please try running this project on your system?

Please let me know if you encounter any issues while setting up or running this test project. Also, share any errors or unusual behaviors you observe, as this information will be critical in diagnosing the problem.

Looking forward to your feedback.

Best regards.