Hello,
I am doing my first tries with the Java Plain API just looking for a WokItem a show it through Groovy script like my first test.
Part of my simple code is:
import org.eclipse.core.runtime.IProgressMonitor;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import com.ibm.team.filesystem.common.workitems.ILinkConstants;
import com.ibm.team.links.client.ILinkManager;
import com.ibm.team.links.common.IItemReference;
import com.ibm.team.links.common.ILink;
import com.ibm.team.links.common.ILinkCollection;
import com.ibm.team.repository.client.IItemManager;
import com.ibm.team.repository.client.ILoginHandler2;
import com.ibm.team.repository.client.ILoginInfo2;
import com.ibm.team.repository.client.ITeamRepository;
import com.ibm.team.repository.client.TeamPlatform;
import com.ibm.team.repository.client.login.UsernameAndPasswordLoginInfo;
import com.ibm.team.repository.common.TeamRepositoryException;
import com.ibm.team.scm.client.IWorkspaceManager;
import com.ibm.team.scm.common.IChange;
import com.ibm.team.scm.common.IChangeSet;
import com.ibm.team.scm.common.IChangeSetHandle;
import com.ibm.team.scm.common.IVersionable;
import com.ibm.team.scm.common.IVersionableHandle;
import com.ibm.team.workitem.client.IWorkItemClient;
import com.ibm.team.workitem.common.model.IWorkItem;
....
try {
println "hello in Try"
// Login to the repository using the provided credentials
ITeamRepository repo = TeamPlatform.getTeamRepositoryService().getTeamRepository(repoUri);
repo.registerLoginHandler(new ILoginHandler2() {
@Override
public ILoginInfo2 challenge(ITeamRepository arg0) {
return new UsernameAndPasswordLoginInfo(userId, password);
}
});
repo.login(new SysoutProgressMonitor());
println "I've logged in successfuly"
// Find the work item on the server
def workItemClient = (IWorkItemClient)repo.getClientLibrary(IWorkItemClient.class);
int workItemNumber = -1;
try {
workItemNumber = Integer.parseInt(wi);
} catch (NumberFormatException e) {
println("Invalid work item nubmer:" + wi);
exit(1);
}
def workItem = workItemClient.findWorkItemById(workItemNumber, IWorkItem.FULL_PROFILE, new SysoutProgressMonitor());
println("["+workItem.getId()+"] "+workItem.getHTMLSummary().getPlainText());
repo.logout();
} finally {
TeamPlatform.shutdown();
}
....
But I get the following error in my console:
>groovy script.groovy
hello
hello in Try
I've logged in successfuly
Caught: java.lang.NoClassDefFoundError: com/ibm/team/workitem/api/common/connectors/IDataConnector
java.lang.NoClassDefFoundError: com/ibm/team/workitem/api/common/connectors/IDataConnector
at script.run(script.groovy:67)
Caused by: java.lang.ClassNotFoundException: com.ibm.team.workitem.api.common.connectors.IDataConnector
... 1 more
I have added API jars into my <user>/.groovy/lib
so I can import them into my script,
but there I cannot see a jar file named like in the error com.ibm.team.workitem.api.common.connectors.IDataConnector
The version I am is the 4.0.2 and jars are too,
How could I fix the error? Should I download the missing jar from somewhere?
Thanks for the help.