Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为什么获取“此页面不是';不工作。。。错误太多重定向`?_Java_Angular_Maven_Angular Cli_Maven Plugin - Fatal编程技术网

Java 为什么获取“此页面不是';不工作。。。错误太多重定向`?

Java 为什么获取“此页面不是';不工作。。。错误太多重定向`?,java,angular,maven,angular-cli,maven-plugin,Java,Angular,Maven,Angular Cli,Maven Plugin,在index.html文件中多次生成相同的脚本文件,我最近将项目升级到angular 8.0.2版本 升级angular版本后,我在index.html文件中遇到了这个复制问题 这是JavaDemoProjectjava项目,我在pom.xml文件的帮助下用这个javaproject运行angular应用程序 <plugin> <groupId>com.github.testDemo</groupId> <artifactId>fr

在index.html文件中多次生成相同的脚本文件,我最近将项目升级到angular 8.0.2版本

升级angular版本后,我在
index.html
文件中遇到了这个复制问题

这是
JavaDemoProject
java项目,我在
pom.xml
文件的帮助下用这个
javaproject
运行angular应用程序

<plugin>
    <groupId>com.github.testDemo</groupId>
    <artifactId>frontend-maven-plugin</artifactId>
    <version>1.6</version>
    <configuration>
        <workingDirectory>../Angular-Project</workingDirectory>
        <installDirectory>temp</installDirectory>
    </configuration>
    <executions>
       <!-- It will install nodejs and yarn -->
       <execution>
           <id>install node and yarn</id>
           <goals>
               <goal>install-node-and-yarn</goal>
           </goals>
           <configuration>
               <nodeVersion>v11.7.0</nodeVersion>
               <yarnVersion>v1.9.4</yarnVersion>
           </configuration>
       </execution>
       <!-- It will execute command "yarn install" inside "/angular" 
            directory -->
       <execution>
          <id>yarn install</id>
          <goals>
             <goal>yarn</goal>
          </goals>
          <configuration>
               <arguments>install</arguments>
          </configuration>
       </execution>
       <!-- It will execute command "yarn build" inside "/angular" 
           directory to clean and create "/dist" directory -->
       <execution>
           <id>yarn javaDemoprod </id>
           <goals>
              <goal>yarn</goal>
           </goals>
           <configuration>
               <arguments>javaDemoprod --outputPath=../JavaDemoProject/
                  src/main/resources/templates/dist</arguments>
           </configuration>
       </execution>
    </executions>
</plugin>
我通过maven命令(
mvn clean install-Penv dev-DskipTests-DbuildNumber=04
)构建项目

  • pom.xml
    文件

    <plugin>
        <groupId>com.github.testDemo</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>1.6</version>
        <configuration>
            <workingDirectory>../Angular-Project</workingDirectory>
            <installDirectory>temp</installDirectory>
        </configuration>
        <executions>
           <!-- It will install nodejs and yarn -->
           <execution>
               <id>install node and yarn</id>
               <goals>
                   <goal>install-node-and-yarn</goal>
               </goals>
               <configuration>
                   <nodeVersion>v11.7.0</nodeVersion>
                   <yarnVersion>v1.9.4</yarnVersion>
               </configuration>
           </execution>
           <!-- It will execute command "yarn install" inside "/angular" 
                directory -->
           <execution>
              <id>yarn install</id>
              <goals>
                 <goal>yarn</goal>
              </goals>
              <configuration>
                   <arguments>install</arguments>
              </configuration>
           </execution>
           <!-- It will execute command "yarn build" inside "/angular" 
               directory to clean and create "/dist" directory -->
           <execution>
               <id>yarn javaDemoprod </id>
               <goals>
                  <goal>yarn</goal>
               </goals>
               <configuration>
                   <arguments>javaDemoprod --outputPath=../JavaDemoProject/
                      src/main/resources/templates/dist</arguments>
               </configuration>
           </execution>
        </executions>
    </plugin>
    
  • 这是
    angular.json
    文件:

    {
      "compileOnSave": false,
      "compilerOptions": {
          "baseUrl": "./",
          "module": "commonjs",
          "outDir": "./dist/out-tsc",
          "sourceMap": true,
          "declaration": false,
          "moduleResolution": "node",
          "emitDecoratorMetadata": true,
          "experimentalDecorators": true,
          "target": "es2015",
          "typeRoots": [
             "node_modules/@types"
          ],
          "lib": [
             "es2017",
             "dom"
          ],
          "resolveJsonModule": true,
          "esModuleInterop": true
      }
    }
    
    "build": {
        "builder": "@angular-devkit/build-angular:browser",
        "options": {
          "outputPath": "dist/Angular-Project",
          "index": "src/index.html",
          "main": "src/main.ts",
          "polyfills": "src/polyfills.ts",
          "tsConfig": "src/tsconfig.app.json",
          "showCircularDependencies": false,
          "assets": [
            "src/favicon.ico",
            "src/eg.ico",
            "src/assets"
          ],
          "styles": [
            "src/styles.scss"
          ],
          "scripts": [],
          "aot": true
        }
      }
    
  • Package.json

    "dependencies": {
      "@angular/animations": "^8.0.1",
      "@angular/cdk": "^8.0.1",
      "@angular/common": "^8.0.1",
      "@angular/compiler": "^8.0.1",
      "@angular/core": "^8.0.1",
      "@angular/forms": "^8.0.1",
      "@angular/material": "^8.0.1",
      "@angular/platform-browser": "^8.0.0",
      "@angular/platform-browser-dynamic": "^8.0.1",
      "@angular/router": "^8.0.1",
      "core-js": "^2.5.4",
      "hammerjs": "^2.0.8",
      "ngx-loading": "^3.0.1",
      "node-sass": "^4.10.0",
      "rxjs": "6.5.2",
      "underscore": "^1.9.1",
      "zone.js": "~0.9.1"
    },
    "devDependencies": {
      "@angular-devkit/build-angular": "~0.800.0",
      "@angular/cli": "~8.0.2",
      "@angular/compiler-cli": "^8.0.1",
      "@angular/language-service": "^8.0.1",
      "@types/jasmine": "~2.8.6",
      "@types/jasminewd2": "~2.0.3",
      "@types/node": "~8.9.4",
      "bootstrap-sass": "^3.3.7",
      "codelyzer": "^5.0.1",
      "jasmine-core": "~2.99.1",
      "jasmine-spec-reporter": "~4.2.1",
      "karma": "~1.7.1",
      "karma-chrome-launcher": "~2.2.0",
      "karma-coverage-istanbul-reporter": "~2.0.0",
      "karma-jasmine": "~1.1.1",
      "karma-jasmine-html-reporter": "^0.2.2",
      "karma-scss-preprocessor": "^3.0.0",
      "protractor": "~5.3.0",
      "ts-node": "~5.0.1",
      "tslint": "~5.9.1",
      "typescript": "~3.4.5"
    }
    
index.html
路径中构建应用程序后 文件
JavaDemoProject\src\main\resources\templates\dist\index.html
我正在复制
script
文件,如何防止复制
script
文件

有人能帮我解决这个问题吗。
提前感谢。

您能够看到的脚本是由于差异加载功能。 Angular 8有一个新功能,可以为旧浏览器和新浏览器生成单独的捆绑包。 您可以控制要支持的浏览器,您可以在上阅读有关此功能的更多信息

您能够看到的脚本是由于差异加载功能。 Angular 8有一个新功能,可以为旧浏览器和新浏览器生成单独的捆绑包。 您可以控制要支持的浏览器,您可以在上阅读有关此功能的更多信息

感谢您在SantoshYadav分享信息,但我在代码中做了相同的更改,然后也得到了相同的
此页面不工作…
。如果我单独运行
angular项目(适用于移动版)
,您能否共享stackblitz或github repo以检查最小配置?stackblitz链接:,它显示
主页
,并在整个应用程序中正常工作。在我的例子中,我们将根据桌面/移动设备的屏幕大小,与
桌面(JAVA)
站点一起部署。在构建和部署应用程序桌面后,工作正常,当我们在移动屏幕中打开时,Angular project无法运行,它显示
此页面无法工作。。。ERR_TOO_MANY_REDIRECTS
,我删除了所有浏览器的历史记录和Cookie,然后也得到了相同的记录。在
日志
文件中显示
处理请求时出错:请求处理失败;嵌套异常为org.thymeleaf.exceptions.TemplateInputException:异常解析文档:template=“/dist/index”,对于URI:/flights,visitorId:null,searchKey:null,IP地址:localhost,请求方法:GET org.springframework.web.util.NestedServletException:请求处理失败;嵌套异常是org.thymeleaf.exceptions.TemplateInputException:异常解析文档:template=“/dist/index”
。thymeleaf无法读取
nomodule
。我该如何解决这个问题呢?谢谢你分享@SantoshYadav的信息,但是我在代码中做了同样的更改,然后也得到了同样的
这个页面不工作了…
。如果我运行
angular项目(移动版),你能分享stackblitz或github repo来检查最小配置吗?stackblitz链接:
单独显示
主页
,并在整个应用程序中正常工作。在我的例子中,我们将根据桌面/移动设备的屏幕大小,与
桌面(JAVA)
站点一起部署。在构建和部署应用程序桌面后,工作正常,当我们在移动屏幕中打开时,Angular project无法运行,它显示
此页面无法工作。。。ERR_TOO_MANY_REDIRECTS
,我删除了所有浏览器的历史记录和Cookie,然后也得到了相同的记录。在
日志
文件中显示
处理请求时出错:请求处理失败;嵌套异常为org.thymeleaf.exceptions.TemplateInputException:异常解析文档:template=“/dist/index”,对于URI:/flights,visitorId:null,searchKey:null,IP地址:localhost,请求方法:GET org.springframework.web.util.NestedServletException:请求处理失败;嵌套异常是org.thymeleaf.exceptions.TemplateInputException:异常解析文档:template=“/dist/index”
。thymeleaf无法读取
nomodule
。我怎样才能解决这个问题?
This page isn't working...
ERR_TOO_MANY_REDIRECTS