0

クラウド プラグインの開発を開始したいと考えています。プラグインは AD 検索ユーザーに接続し、AD の特定のプロパティを取得する必要があります。だから私はこれに従い始めました。過去に開発した JIRA プラグイン用に Atlassian-SDK をインストール済みです。だから私は新しいプラグインを作成しました

atlas-create-crowd-plugin

そして、作成コマンドが私から作成し、サンプルコードにコピーしたクラスを消去した後、これは機能しませんでした(コンパイルの問題)。だから私は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 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
        <groupId>myGroupId</groupId>
        <artifactId>myArtifactId</artifactId>
        <version>1.0-SNAPSHOT</version>
        <organization>
            <name>Example Company</name>
            <url>http://www.example.com/</url>
        </organization>

    <name>event-listener-example</name>
        <description>This is an event listener plugin for Atlassian Crowd.</description>

    <packaging>atlassian-plugin</packaging>

    <dependencies>
            <dependency>
                    <groupId>com.atlassian.crowd</groupId>
                    <artifactId>crowd-events</artifactId>
                    <version>${crowd.version}</version>
                    <cope>provided</scope>
            <dependency>
        <dependency>
            <groupId>com.atlassian.event</groupId>
            <artifactId>atlassian-event</artifactId>
            <version>3.0.0</version>
            <scope>provided</scope>
        </dependency>
        </dependencies>
        <build>
            <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>maven-crowd-plugin</artifactId>
                <version>6.2.1</version>
                        <extensions>true</extensions>
                        <configuration>
                                <productVersion>${crowd.version}</productVersion>
                    <productDataVersion>${crowd.data.version}</productDataVersion>
                        </configuration>
            </plugin>
            <plugin>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                        <configuration>
                    </plugin>
            </plugins>
     </build>
     <properties>
    <crowd.version>2.8.4</crowd.version>
        <crowd.data.version>2.8.4</crowd.data.version>
    <atlassian.plugin.key>${project.groupId}.${project.artifactId}  </atlassian.plugin.key>
    </properties>
 </project>

ここでは、少し変更したことがわかります (バージョン、および atlassian-event 依存関係を追加)。

次に、 atlassian-plugin.xml を変更しました:

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" 
    plugins-version="2">  
    <plugin-info>  
        <description>${project.description}</description>  
        <version>${project.version</version>  
        <vendor name="${project.organization.name}" 
            url="${project.organization.url}" />  
        <param name="plugin-icon">images/pluginIcon.png</param>  
        <param name="plugin-logo">images/pluginLogo.png</param>  
    </plugin-info>  
    <resource type="i18n" name="i18n" location="kgSynchro" />  
    <listener name="User Created Listener" key="usercreatedlistener"  
        class="myPackage.NewUserEventListener">  
        <description>Will listen for user creation 
             events.</description>  
    </listener>  
</atlassian-plugin>

そして最後に私のクラス:

package myPackage.events;
import org.slf4j.Logger; 
import org.slf4j.LoggerFactory; 
import com.atlassian.crowd.event.user.UserCreatedEvent; 
import com.atlassian.event.api.EventListener; 
public class NewUserEventListener {  
    private final Logger log = LoggerFactory.getLogger                  (NewUserEventListener.class);  

    @EventListener  public void printUserCreatedEvent(
        UserCreatedEvent event) {  
            System.out.println("User " + event.getUser                      ().getDisplayName() + " has been created.");  
            log.error("new User is CREATED"); 
    } 
} 

例と同じですが、メソッドの呼び出しをログに記録するために Logger を追加しました。

次に、atlas-run で crod 環境を開始し (atlas-debug も試しました)、ユーザー UI に移動して新しいユーザーを追加しようとしました。ユーザーは正しく作成されましたが、ログには私の方法について何も表示されません。次の点について多くのエラーがあります。

 The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]

しかし、これは私が群集をナビゲートするすべてのページで発生します.....そして、これは私のメソッドが呼び出されないという事実には関係ありません。

問題を見つけるために何をしようとするかについて、それぞれにいくつかのヒントがありますか?

タンクは非常に進んでいます

4

1 に答える 1

0

リスナーのパスは「myPackage.events.NewUserEventListener」です。atlassian-plugin.xml リスナー セクションを以下のコードに変更します。

<listener name="User Created Listener" key="usercreatedlistener"  
    class="myPackage.events.NewUserEventListener">  
    <description>Will listen for user creation events.</description>  
</listener>

また、 Java Naming Conventionを実践するのも良いでしょう。これがお役に立てば幸いです。

ありがとう、

ヴィカシュ

于 2016-03-08T15:09:44.567 に答える