Programing

GWT 모듈을 REDUX로 (재) 컴파일해야 할 수 있습니다.

lottogame 2020. 12. 9. 07:42
반응형

GWT 모듈을 REDUX로 (재) 컴파일해야 할 수 있습니다.


컴파일 모드에서 실행할 때이 두려운 GWT 모듈 'mymodule'이 (재) 컴파일 된 대화 메시지가 필요할 수 있습니다.

컴파일 모드에서 실행되는 GWT에서이 오류 메시지가 주어 졌을 때 다른 사람들이 시도해 볼 것을 제안한 목록을 컴파일했습니다. maven에서 만든 WAR 파일을 열었고 모든 파일이 올바른 위치에 있습니다. 이 오류가 발생하지 않는 다른 GWT maven 프로젝트에 대해 이것을 확인했습니다. 그러나 아래 제안 중 어느 것도 문제를 해결하지 못했습니다. 또한이 두 프로젝트 사이에 어떤 차이점이 있는지 확인할 수 없었습니다. 작동하는 프로젝트와 컴파일 모드에서 실행되지 않는 프로젝트입니다.

또 무엇을 시도 할 수 있습니까?


src/main/webapp"war 폴더"로 사용하여 DevMode를 시작 했습니까 ? 또는 다른 말로, *.nocache.js당신의 src/main/webapp? 이 경우이 파일은 gwt-maven-plugin에 의해 호출 된 GWT 컴파일러에 의해 생성 된 파일을 덮어 씁니다.

*.nocache.jsDevMode를 (아무도 존재하지 않는 경우, 이전 GWT 편집에 의해 생성)에 의해 생성 된은을 DevMode를 시작할 만 필요한 비트를 포함하고, 그렇지 않으면 상기의 오류로 실패 할 것이다.


호출 <MODULE_NAME>.nocache.js파일 src/main/webapp/<MODULE_NAME>찾아 삭제 / 이름을 변경합니다.

그런 다음 mvn 패키지를 수행하면 모두 괜찮습니다.

이 문제는 Eclipse에서 Dev 모드를 실행할 때 발생할 수 있습니다. Eclipse는 nocache.js 파일을 생성하여 src/main/webapp디렉토리에 넣습니다 .

그런 mvn pacakge다음를 실행 하면 maven 플러그인이 배포를 생성하고 nocache.js올바른 위치에 배치하지만 파일을 전쟁으로 패키징 nocache.js하면 Eclipse가 생성 한 배포 오버 라이트됩니다.


응용 프로그램의 다른 페이지 (예 : myModule2.html)에 대한 정적 링크가있는 경우 DevMode에서 동일한 문제를 발견했습니다. ? gwt.codesvr = 127.0.0.1 : 9997 문자열 이 없기 때문에 정적 (이미 컴파일 된) GWT 앱으로 해석 되었으나 그렇지 않은 경우 언급 한 오류 코드가 발생했습니다.

여기에 이미지 설명 입력

물론 해결책은 하드 코딩 된 리터럴 링크를 사용하는 것이 아니라 GWT가이를 생성하도록하는 것입니다. 누군가에게 도움이되기를 바랍니다.

최신 정보:

이것은 표준 GWT * .nocache.js 파일에서이 오류를 발생시키는 코드입니다.

function B() {
    var b = false;
    try {
    var c = Window.location.search;
    return (c.indexOf("gwt.hosted=") != -1 
        || (c.indexOf("gwt.codesvr=") != -1
        || Window.external && Window.external.gwtOnLoad)) 
        && c.indexOf("gwt.hybrid") == -1
    } catch (a) {}
    B = function () {
    return b
    };
    return b
}
// and later, if B() returns false, show recompile error
if (!B()) {
    try {
    alert(Pb);
    return;
    }
  ...
}

따라서 컴파일러 메시지를 방지하려면

  • URL에 gwt.hybrid가 없습니다.
  • 그리고 gwt.hosted =가 없습니다.
  • 또는 get.codesvr =
  • 또는 Window.external.getOnLoad 메서드

따라서 팝업의 경우 일부 서버 코드가 DevMode 세션 URL을 리디렉션했지만 "codesvr ="매개 변수를 다시 추가하지 않았으므로 경고가 표시되었습니다.


Have you compiled the source? This is a surprisingly non-obvious step. If you're using eclipse, you can compile by clicking the red toolbox icon.


You have to run mvn gwt:compile additionally to the usual mvn clean install package, as the GWT-compilation is NOT part of the maven-package-phase. This solves the annoying Javascript-(re)compile-error.


I had a similar problem. Doing mvn clean install on my GWT project got me a war file, which upon deploying in tomcat resulted in the same "GWT Module 'mymodule' may need to be (re)compiled" dialog message. I also did all the mentioned stuff in here without any success.

Doing mvn clean install -DskipTests=true did the job for me.
OR
Doing mvn clean install without invoking the generated test URL (sth. like this: http://<localIp>:53701/mymoduleJUnit.JUnit/junit-standards.html?gwt.codesvr=<localIp>:53697)

The test phase obviously did overwrite my initially created *.nocache.js via some fancy development mode url, thus packaging me a wrong *.nocache.js in the end.


My Dev mode was correctly configured and above solution didn't work. Following did solve the issue though.

Multiple steps:

  1. Update Project properties -> deployment Assembly using Deploy GWT maven project with eclipse deploys webapp directory instead of target/project directory
  2. mvn clean package
  3. mvn gwt:compile
  4. In eclipse, click on 'GWT Compile Project' -> Advacned -> Remove '-war src/main/webapp' argument and hit compile.

Output should be like this - Linking into target/project-1.0-SNAPSHOT/ModuleName

... and deployment works fine.


이것은 다른 모든 유효한 답변에도 적용될 수 있습니다. 때로는 그중 하나를 따른 후 하드 / 캐시 브라우저 새로 고침 (ctrl + F5)을 수행해야 할 수도 있습니다.

참고 URL : https://stackoverflow.com/questions/5719118/gwt-module-may-need-to-be-recompiled-redux

반응형