2017-07-01 15 views
0

org.codehaus.groovy.grails.commons.ApplicationHolderクラスはgrails 2.3.x以降で廃止されていることが知られています。しかし、それを使用する多くのプラグインがあります。 私のアプリケーションの1つでは、https://grails.org/plugin/excel-import?skipRedirect=trueが使用されましたが、これは廃止予定であり、grails 2.4には同等のものは存在しません(ただし、grails 3には1つあります)。 私のアプリケーションはこのプラグインを使用していますので、最新のバージョンを使用するために屈折させる必要はありません。だからorg.codehaus.groovy.grails.commons.ApplicationHolderHolders.grailsApplicationに解決されるような方法がありますか?プラグインで解決しないsrc/javaからのGrails 2.xクラス

私はすでにこのコンテンツを持っているのsrc/javaのフォルダに org.codehaus.groovy.grails.commons.ApplicationHolderを作成している

:どのように

..myapproot\target\work\plugins\excel-import-1.0.0\grails-app\services\org\grails\plugins\excelimport\ExcelImportService.groovy: 13: unable to resolve class org.codehaus.groovy.grails.commons.ApplicationHolder 
@ line 13, column 1. 
    import org.codehaus.groovy.grails.commons.ApplicationHolder 
^

1 error 

だから、わからない:私はこのエラーを取得するプロジェクトを実行するとき

/* 
* Copyright 2004-2005 the original author or authors. 
* 
* Licensed under the Apache License, Version 2.0 (the "License"); 
* you may not use this file except in compliance with the License. 
* You may obtain a copy of the License at 
* 
*  http://www.apache.org/licenses/LICENSE-2.0 
* 
* Unless required by applicable law or agreed to in writing, software 
* distributed under the License is distributed on an "AS IS" BASIS, 
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
* See the License for the specific language governing permissions and 
* limitations under the License. 
*/ 
package org.codehaus.groovy.grails.commons; 

import grails.util.GrailsUtil; 
import grails.util.Holders; 

/** 
* Static singleton holder for the GrailsApplication instance. 
* 
* @author Marc Palmer ([email protected]) 
* 
* @deprecated Use dependency injection or implement GrailsApplicationAware instead 
*/ 
@Deprecated 
public abstract class ApplicationHolder { 

    /** 
    * @return The GrailsApplication instance 
    * @deprecated Use dependency injection instead 
    */ 
    @Deprecated 
    public static GrailsApplication getApplication() { 
     GrailsUtil.deprecated("Method ApplicationHolder.getApplication() is deprecated and will be removed in a future version of Grails."); 
     return Holders.getGrailsApplication(); 
    } 

    /** 
    * @param application The application to set 
    * @deprecated Use dependency injection instead 
    */ 
    @Deprecated 
    public static void setApplication(GrailsApplication application) { 
     Holders.setGrailsApplication(application); 
    } 
} 

しかし、まだエクセルインポートプラグインをこのクラスを使用するようにしますか(私のアプリケーションが使用するgrails 2.4.4のApplicationHolderクラスが見つかりません)?

EDIT 私は、intellijではなくgrailsコマンドラインで実行してみました。同じ結果!

答えて

1

So is there a way so that the org.codehaus.groovy.grails.commons.ApplicationHolder resolves to Holders.grailsApplication ?

あなたが本当にプラグインの古いバージョンを使用する必要がある場合は、1 hackus-majorisはsrc/groovy/org/codehaus/groovy/grails/commons/ApplicationHolder.groovy(または.java)の下で、独自のApplicationHolderクラスを追加することです。

関連する問題