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

时间:2017-12-12 14:10:11

标签: java plugins jira

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

目前,我正在使用atlas-run命令编译项目,而我在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;
    }

}

我引用的第二课:

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);


    }

}

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

1 个答案:

答案 0 :(得分:0)

使用像Eclipse这样的IDE来查看这些常见错误,例如缺少半冒号和大括号。例如,请参阅GetUsers类中的import语句缺少分号

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

应该是

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

缺少半结肠。

你还需要

ListUser.class 

而不是

ListUser.class()

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