0

この非常に単純なコードはコンパイルできません。私はJavaのプロではありませんが、これは標準的なものであり、うまくいくはずです!

String fields = "a,b,c";
String[] fields_array = fields.split(',');

コンパイルされません

mvn test clean

cannot find symbol symbol  : method split(char)
location: class java.lang.String

pom.xml

<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 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>simple-service</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>simple-service</name>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.glassfish.jersey</groupId>
                <artifactId>jersey-bom</artifactId>
                <version>${jersey.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-grizzly2-http</artifactId>
        </dependency>
         <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-moxy</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.9</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.3</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>de.abas.ceks</groupId>
            <artifactId>jedp</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>de.abas.jfop</groupId>
            <artifactId>base</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>de.abas.eks</groupId>
            <artifactId>jfop</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>de.abas.erp</groupId>
            <artifactId>common</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency> 
            <groupId>net.sourceforge.javautil</groupId> 
            <artifactId>common</artifactId> 
            <version>0.0.5</version> 
            <scope>compile</scope> 
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.6</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <!-- <inherited>true</inherited> -->
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>com.example.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository> 
            <id>javautil</id> 
            <name>Java Util Repository</name> 
            <url>http://downloads.sourceforge.net/project/javautil/</url> 
        </repository>
    </repositories>

    <properties>
        <jersey.version>2.2</jersey.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>

輸入品

package com.example;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.QueryParam;

import de.abas.ceks.jedp.*;

import java.lang.String;
4

1 に答える 1