JIRA Java API 开发 - atlas-运行 编译器错误

JIRA Java API development - atlas-run compiler error

我目前正在开发一个 JIRA 插件,它将为我提供 JIRA 应用程序中的所有用户。

目前,我正在使用 atlas-运行 命令编译项目,同时我在 JAR/XML 文件的目录中。

我现在有四个错误:

[INFO] 4 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.577 s
[INFO] Finished at: 2017-12-12T14:06:22+00:00
[INFO] Final Memory: 23M/447M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.
7.0:compile (default-compile) on project myPlugin: Compilation failure: Compilat
ion failure:
[ERROR] /C:/Users/bed2scp/workspace/myPlugin/src/main/java/com/atlassian/tutoria
l/myPlugin/api/GetUsers.java:[4,45] ';' expected
[ERROR] /C:/Users/bed2scp/workspace/myPlugin/src/main/java/com/atlassian/tutoria
l/myPlugin/api/UserToCSV.java:[8,55] ')' expected
[ERROR] /C:/Users/bed2scp/workspace/myPlugin/src/main/java/com/atlassian/tutoria
l/myPlugin/api/UserToCSV.java:[8,56] illegal start of type
[ERROR] /C:/Users/bed2scp/workspace/myPlugin/src/main/java/com/atlassian/tutoria
l/myPlugin/api/UserToCSV.java:[8,57] <identifier> expected
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption

当我查看我的 Java 代码时,我可以看到在第 4、45 行和第 8、55 行识别的两个错误不存在:

import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.user;
import com.atlassian.jira.user.util.UserManager;
import com.atlassian.jira.api;
import com.bosch.plugin.user.list.impl.MyPluginComponentImpl;
import com.atlassian.jira.web.action.admin.user.UserBrowser;
import com.sun.istack.internal.Nullable;
import com.atlassian.jira.user.UserKeyService;

import java.lang.String;
import java.util.ArrayList;
import java.util.Collection;
import javax.annotation.*;


@RunWith(AtlassianPluginsTestRunner.class)
public class GetUsers
{
    private String name;
    private String userName;
    private long directoryId;
    private String emailAddress;
    private boolean isActive;

    public void Validator(String name, String userName, long directoryId, String emailAddress, boolean isActive)
    {
        this.name = name;
        this.userName = userName;
        this.emailAddress = emailAddress;
        this.isActive = isActive;
    }

    public static void main(String[] args) {
        System.out.println("entry point of app");
    }

    //compare user name
    public int compareTo(User user){
        return name.compareTo(user.getName());
    }

    //getter and setter for name
    public String getName(){
        return name;
    }

    //getter and setter for user name
    public String getuserName(){
        return userName;
    }
    //getter and setter for email
    public String getEmailAddress(){
        return emailAddress;
    }
    //getter and setter for directory ID in JIRA
    public long getDirectoryId(){
        return directoryId;
    }
    //getter and setter for checking if user is active
    public boolean isActive(){
        return isActive;
    }

    public User userIterator(User loggedInUser, Project currentProject) {
        loggedInUser = authenticationContext.getLoggedInApplicationUser();
        return loggedInUser;
    }

    public ArrayList<User> getAllUsers(){
        ArrayList<User> all = new ArrayList<User>(getAllUsers());
        return all;
    }

    public ArrayList<User> getAllUsersInGroups(Collection<String> arg0){
        ArrayList<User> allUsersandGroups = new ArrayList<User>(getAllGroups());
        return allUsersandGroups;
    }

    public ArrayList<User> getAllGroups(){
        ArrayList<User> allGroups = new ArrayList<User>(getGroups());
        return allGroups;
    }

}

我的第二个 class 被引用:

import java.io.FileWriter;
import java.util.Logging;


public class UserToCSV extends GetUsers {
    final Logger LOG = Logger.getLogger(ListUser.class());

    public void exportToCSV(){
        final String[] HEADER = {"Application", "Username", "Fullname", "Authorization"};
        FileWriter fileWriter = new FileWriter(fileWriter);


    }

}

我想知道是否有人以前有过这方面的经验?我认为问题与外部导入库有关。

使用像 Eclipse 这样的 IDE 来查看这些常见错误,例如缺少分号和大括号。例如,在 GetUsers class 中查看您的导入语句缺少分号

import com.atlassian.crowd.embedded.api.User

应该是

import com.atlassian.crowd.embedded.api.User;

缺少分号。

你还需要

ListUser.class 

而不是

ListUser.class()

正如我之前提到的,请开始使用 IDE。