Primeicons не работает с угловой + пружинной загрузкой - PullRequest
0 голосов
/ 27 сентября 2019

Я перевожу старый весенний проект с angular и jboss-eap7.0 в файл jar весенней загрузки.

Все отлично работает, когда я использую ng-serve , но когда я помещаю все свои статические файлы из ng-build --prod в мой файл:

src/main/resources/static

Все значки из компонентов primeng не загружаются, вместо этого у меня появляется пустой квадрат.

Мои угловые приложения работают довольно хорошо, мои единственные проблемы - примитивы

Я использую:

Spring Boot 2.1.7.RELEASE, Angular 6.1.3,PrimeNG 6.1.5

Я уже провел много исследований и не смог найти ничего, что могло бы решить мою проблему.

Я отключил всю Spring-security, создал несколько @ Configurations для отключенного префикса и прочее.

Вот моя package.json и моя pom.xml и моя структура файлов проекта.

{
  "name": "fdi",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.3",
    "@angular/common": "^6.1.3",
    "@angular/compiler": "^6.1.3",
    "@angular/core": "^6.1.3",
    "@angular/forms": "^6.1.3",
    "@angular/http": "^6.1.3",
    "@angular/platform-browser": "^6.1.3",
    "@angular/platform-browser-dynamic": "^6.1.3",
    "@angular/router": "^6.1.3",
    "@angular/upgrade": "~6.1.3",
    "@types/core-js": "~0.9.34",
    "@types/jszip": "^3.1.4",
    "@types/node": "~6.0.46",
    "angular2-jwt": "~0.1.27",
    "angular2-materialize": "^15.1.10",
    "animate.css": "^3.7.0",
    "bootstrap": "^3.3.7",
    "core-js": "^2.5.4",
    "enum-values": "~1.0.1",
    "es6-promise": "~3.0.2",
    "es6-shim": "~0.33.3",
    "file-saver": "^2.0.2",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "inputmask": "^4.0.8",
    "install": "^0.10.1",
    "jquery": "^3.1.1",
    "jszip": "^3.1.4",
    "material-design-icons": "^3.0.1",
    "materialize-css": "^0.100.2",
    "moment": "^2.24.0",
    "ng2-currency-mask": "^5.3.1",
    "ng2-nvd3": "~1.1.3",
    "ng2-popover": "0.0.11",
    "ngx-ui-switch": "^8.2.0",
    "primeicons": "2.0.0",
    "primeng": "6.1.5",
    "reflect-metadata": "~0.1.8",
    "rxjs": "^6.1.3",
    "rxjs-compat": "^6.5.2",
    "systemjs": "0.19.39",
    "tslib": "^1.9.0",
    "vanilla-masker": "^1.2.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.0",
    "@angular/cli": "~6.1.3",
    "@angular/compiler-cli": "^6.1.3",
    "@angular/language-service": "^6.1.3",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/jquery": "^3.3.30",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.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": "~1.4.2",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.8.0"
  }
}

и

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.7.RELEASE</version>
        <relativePath />
        <!-- lookup parent from repository -->
    </parent>
    <groupId>br.gov.sde</groupId>
    <artifactId>fdi</artifactId>
    <version>t_5.0.0-RC1_build_01</version>
    <packaging>jar</packaging>
    <name>Fundo de Desenvolvimento Industrial</name>
    <description>Software Para Controle de Benefício do Estado do Ceará</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- JBoss dependency versions -->
        <version.wildfly.maven.plugin>1.1.0.Alpha11</version.wildfly.maven.plugin>
        <version.jboss.bom.eap>7.0.2.GA</version.jboss.bom.eap>

        <!-- Third Party -->
        <version.postgres>9.4.1208.jre7</version.postgres>
        <org.slf4j-version>1.6.6</org.slf4j-version>
        <version.apache.poi>3.15</version.apache.poi>

        <!-- maven-compiler-plugin -->
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <version.maven.surefire>2.19</version.maven.surefire>
        <angular.project.location>src/main/frontend</angular.project.location>
        <angular.project.nodeinstallation>target/node-installation-dir</angular.project.nodeinstallation>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <scope>provided</scope>
        </dependency>

        <!--        
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency> -->

        <!-- exclude logback , add log4j2 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>

        <!-- asynchronous loggers -->
        <dependency>
            <groupId>com.lmax</groupId>
            <artifactId>disruptor</artifactId>
            <version>3.4.2</version>
        </dependency>

        <!-- PostgreSQL JDBC -->

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${version.postgres}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.restdocs</groupId>
            <artifactId>spring-restdocs-mockmvc</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-envers</artifactId>
            <version>3.6.4.Final</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-jpamodelgen</artifactId>
            <version>5.4.0.Final</version>
        </dependency>

        <!-- Apache commons lang -->
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>

        <!-- Apache POI -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>${version.apache.poi}</version>
        </dependency>

        <dependency>
            <groupId>fr.opensagres.xdocreport</groupId>
            <artifactId>fr.opensagres.poi.xwpf.converter.pdf</artifactId>
            <version>2.0.0</version>
        </dependency>

        <!-- Scheduler Quartz -->
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>2.2.1</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
            <scope>compile</scope>
            <version>1.2.17</version>
        </dependency>

        <!-- Apache metamodel / MetaModel-excel -->
        <dependency>
            <groupId>org.apache.metamodel</groupId>
            <artifactId>MetaModel-excel</artifactId>
            <version>4.6.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.poi</groupId>
                    <artifactId>poi-ooxml</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Jasper -->
        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>6.3.1</version>
        </dependency>

        <!-- JWT -->
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.7.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.velocity/velocity -->
        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <version>1.7</version>
        </dependency>

        <!-- Java Mail API -->
        <!-- <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> 
            <version>1.4.7</version> </dependency> -->

        <!-- Jackson -->
        <!-- <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> 
            <version>2.8.5</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> 
            <artifactId>jackson-datatype-jsr310</artifactId> <version>2.4.0</version> 
            </dependency> -->

    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>1.5.8</version>
                <executions>
                    <execution>
                        <id>generate-docs</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>html</backend>
                            <doctype>book</doctype>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.springframework.restdocs</groupId>
                        <artifactId>spring-restdocs-asciidoctor</artifactId>
                        <version>${spring-restdocs.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <jvmArguments> -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787
                    </jvmArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <phase>prepare-package</phase>
                    <delimiters>
                        <delimiter>@</delimiter>
                    </delimiters>
                    <resources>
                        <resource>
                            <directory>src/main/resources</directory>
                            <filtering>true</filtering>
                        </resource>
                    </resources>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>dev</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <activatedProperties>dev</activatedProperties>
            </properties>
            <build>
                <finalName>${project.artifactId}</finalName>
                <plugins>
                    <!-- Plug-in para alterar constantes para produção -->
                    <plugin>
                        <groupId>com.google.code.maven-replacer-plugin</groupId>
                        <artifactId>replacer</artifactId>
                        <version>1.5.2</version>
                        <executions>
                            <execution>
                                <id>set-ambiente</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>replace</goal>
                                </goals>
                                <configuration>
                                    <file>${project.basedir}/${angular.project.location}/src/app/ambiente.ts</file>
                                    <replacements>
                                        <replacement>
                                            <token>true</token>
                                            <value>false</value>
                                        </replacement>
                                    </replacements>
                                </configuration>
                            </execution>

                            <execution>
                                <id>set-constante</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>replace</goal>
                                </goals>
                                <configuration>
                                    <file>${project.basedir}/${angular.project.location}/src/app/constantes.ts</file>
                                    <regex>false</regex>
                                    <replacements>
                                        <replacement>
                                            <token>'/fdi'</token>
                                            <value>'http://localhost:8080/fdi'
                                            </value>
                                        </replacement>
                                    </replacements>
                                </configuration>
                            </execution>

                            <execution>
                                <id>set-versao</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>replace</goal>
                                </goals>
                                <configuration>
                                    <file>${project.basedir}/${angular.project.location}/src/app/app.component.html</file>
                                    <replacements>
                                        <replacement>
                                            <token>${project.version}</token>
                                            <value>VERSAO_PROJETO</value>
                                        </replacement>
                                    </replacements>
                                </configuration>
                            </execution>

                            <!-- <execution>
                                <id>set-profile-spring</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>replace</goal>
                                </goals>
                                <configuration>
                                    <file>${project.basedir}/src/main/resources/application.properties</file>
                                    <replacements>
                                        <replacement>
                                            <token>@activatedProperties@</token>
                                            <value>dev</value>
                                        </replacement>
                                    </replacements>
                                </configuration>
                            </execution> -->
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <version>1.7.6</version>
                        <configuration>
                            <workingDirectory>${angular.project.location}</workingDirectory>
                            <installDirectory>${angular.project.nodeinstallation}</installDirectory>
                            <skip>${frontend.skip}</skip>
                        </configuration>
                        <executions>
                            <!-- It will install nodejs and npm -->
                            <execution>
                                <id>install node and npm</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>install-node-and-npm</goal>
                                </goals>
                                <configuration>
                                    <nodeVersion>v10.16.0</nodeVersion>
                                    <npmVersion>6.9.0</npmVersion>
                                </configuration>
                            </execution>

                            <!-- It will execute command "npm install" inside "/e2e-angular2" 
                                directory -->
                            <execution>
                                <id>npm install</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <configuration>
                                    <arguments>install</arguments>
                                </configuration>
                            </execution>
                            <!-- It will execute command "npm build" inside "/e2e-angular2" directory 
                                to clean and create "/dist" directory -->
                            <execution>
                                <id>npm build</id>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <phase>prepare-package</phase>
                                <configuration>
                                    <arguments>run build</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- copiar dependencias -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>2.4.2</version>
                        <executions>
                            <execution>
                                <id>default-copy-resources</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <overwrite>true</overwrite>
                                    <!-- This folder is the folder where your angular files will be 
                                        copied to. It must match the resulting war-file name. So if you have customized 
                                        the name of war-file for ex. as "app.war" then below value should be ${project.build.directory}/app/ 
                                        Value given below is as per default war-file name -->
                                    <outputDirectory>${project.build.directory}/classes/resources/</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${project.basedir}/${angular.project.location}/dist/fdi/</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.wildfly.plugins</groupId>
                        <artifactId>wildfly-maven-plugin</artifactId>
                        <version>2.0.0.Final</version>
                        <!-- Seu diretório de instalação do JBOSS -->
                        <configuration>
                            <!-- <jboss-home>/home/igor/dev/jboss-eap-7.0</jboss-home> -->
                            <jboss-home>/home/rafael/dev/tools/servers/jboss-eap-7.0</jboss-home>
                            <!-- <jboss-home>/home/arthur/dev/tools/servers/jboss-eap-7.0</jboss-home> -->
                            <javaOpts>-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n</javaOpts>
                            <startupTimeout>300</startupTimeout>
                            <timeout>300</timeout>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                    <!-- <exclusions>
                        <exclusion>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-starter-tomcat</artifactId>
                        </exclusion>
                    </exclusions> -->
                </dependency>
            </dependencies>
        </profile>
</project>


Структура проекта

Экран печати

...