ng使用frontend-maven-plugin构建

时间:2018-08-27 10:29:12

标签: maven maven-plugin

我正在尝试使用Maven / Eclipse和frontend-maven-plugin构建Angular应用程序:

<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
    <workingDirectory>src/main/angular5/tourism</workingDirectory>
    <!-- where to install npm -->
    <installDirectory>src/main/angular5/tourism</installDirectory>
</configuration>                
<executions>
    <execution>
        <id>install node and npm</id>
        <goals>
            <goal>install-node-and-npm</goal>
        </goals>
        <phase>generate-resources</phase>
        <configuration>
            <nodeVersion>v8.11.3</nodeVersion>
            <npmVersion>6.3.0</npmVersion>                        
        </configuration>                        
    </execution>
    <execution>
            <id>npm install</id>
            <goals>
                <goal>npm</goal>
            </goals>
            <!-- Optional configuration which provides for running any npm command -->
            <configuration>
                <arguments>install</arguments>
                <workingDirectory>src/main/angular5/tourism</workingDirectory>
            </configuration>
     </execution>
     <execution>
         <id>prod</id>
         <goals>
           <goal>npm</goal>
         </goals>
         <configuration>
           <arguments>run-script build</arguments>
           <workingDirectory>src/main/angular5/tourism</workingDirectory>
         </configuration>
         <phase>generate-resources</phase>
      </execution>                                                         
</executions>
</plugin>

通常,当maven运行ng build时,它应该在dist目录中生成编译文件。

尽管,如下面的打印屏幕所示,我在dist目录中没有正确的结果。

你能帮我吗?

enter image description here

enter image description here

这是控制台日志中的输出:

[INFO] Running 'npm run-script build' in /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/src/main/angular5/tourism
[DEBUG] Executing command line [/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/src/main/angular5/tourism/node/node, /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/src/main/angular5/tourism/node/node_modules/npm/bin/npm-cli.js, run-script, build]
[INFO] 
[INFO] > tourism@0.0.0 build /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/src/main/angular5/tourism
[INFO] > ng build
[INFO] 
[INFO] 
[INFO] [0mDate: [1m[37m2018-08-27T07:17:09.657Z[39m[22m[0m
[INFO] [0mHash: [1m[37m237de58c14f4f60a6461[39m[22m[0m
[INFO] [0mTime: [1m[37m10899[39m[22mms[0m
[INFO] [0mchunk {[1m[33mmain[39m[22m} [1m[32mmain.js, main.js.map[39m[22m (main) 9.45 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[INFO] [0mchunk {[1m[33mpolyfills[39m[22m} [1m[32mpolyfills.js, polyfills.js.map[39m[22m (polyfills) 227 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[INFO] [0mchunk {[1m[33mruntime[39m[22m} [1m[32mruntime.js, runtime.js.map[39m[22m (runtime) 5.22 kB [1m[33m[entry][39m[22m[1m[32m [rendered][39m[22m[0m
[INFO] [0mchunk {[1m[33mstyles[39m[22m} [1m[32mstyles.js, styles.js.map[39m[22m (styles) 15.7 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[INFO] [0mchunk {[1m[33mvendor[39m[22m} [1m[32mvendor.js, vendor.js.map[39m[22m (vendor) 2.74 MB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[DEBUG] Exit value 0
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ tourism-web ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1, ConflictMarker.markTime=0, ConflictMarker.nodeCount=78, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=26, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=3, ConflictResolver.conflictItemCount=75, DefaultDependencyCollector.collectTime=150, DefaultDependencyCollector.transformTime=4}
[DEBUG] org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3:
[DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-project:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-profile:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-core:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6:compile
[DEBUG]       org.apache.maven.reporting:maven-reporting-api:jar:2.0.6:compile
[DEBUG]          org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7:compile
[DEBUG]       org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-error-diagnostics:jar:2.0.6:compile
[DEBUG]       commons-cli:commons-cli:jar:1.0:compile
[DEBUG]       org.apache.maven:maven-plugin-descriptor:jar:2.0.6:compile
[DEBUG]       org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile
[DEBUG]       classworlds:classworlds:jar:1.1:compile
[DEBUG]    org.apache.maven:maven-artifact:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-settings:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-model:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-monitor:jar:2.0.6:compile
[DEBUG]    org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG]       junit:junit:jar:3.8.1:compile
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:2.0.5:compile
[DEBUG]    org.apache.maven.shared:maven-filtering:jar:1.0-beta-4:compile
[DEBUG]       org.sonatype.plexus:plexus-build-api:jar:0.0.4:compile
[DEBUG]    org.codehaus.plexus:plexus-interpolation:jar:1.13:compile
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-resources-plugin:2.4.3
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-resources-plugin:2.4.3
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-resources-plugin:2.4.3
[DEBUG]   Included: org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3
[DEBUG]   Included: org.apache.maven.reporting:maven-reporting-api:jar:2.0.6
[DEBUG]   Included: org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7
[DEBUG]   Included: commons-cli:commons-cli:jar:1.0
[DEBUG]   Included: org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4
[DEBUG]   Included: junit:junit:jar:3.8.1
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:2.0.5
[DEBUG]   Included: org.apache.maven.shared:maven-filtering:jar:1.0-beta-4
[DEBUG]   Included: org.sonatype.plexus:plexus-build-api:jar:0.0.4
[DEBUG]   Included: org.codehaus.plexus:plexus-interpolation:jar:1.13
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-resources-plugin:2.4.3, parent: sun.misc.Launcher$AppClassLoader@55f96302]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources' with basic configurator -->
[DEBUG]   (f) buildFilters = []
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) escapeWindowsPaths = true
[DEBUG]   (s) includeEmptyDirs = false
[DEBUG]   (s) outputDirectory = /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/classes
[DEBUG]   (s) overwrite = false
[DEBUG]   (f) project = MavenProject: tourism-guide-web:tourism-web:1.0.0-SNAPSHOT @ /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/pom.xml
[DEBUG]   (s) resources = [Resource {targetPath: null, filtering: false, FileSet {directory: /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/src/main/resources, PatternSet [includes: {}, excludes: {}]}}]
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@439a8f59
[DEBUG]   (f) useBuildFilters = true
[DEBUG]   (s) useDefaultDelimiters = true
[DEBUG] -- end configuration --
[DEBUG] properties used {java.vendor=Oracle Corporation, sun.java.launcher=SUN_STANDARD, env.XPC_SERVICE_NAME=org.eclipse.platform.ide.1804, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, env.JAVA_STARTED_ON_FIRST_THREAD_791=1, os.name=Mac OS X, sun.boot.class.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/classes, env.TMPDIR=/var/folders/cj/18nnbwrn68v72gpfnc09tpl80000gn/T/, java.vm.specification.vendor=Oracle Corporation, java.runtime.version=1.8.0_77-b03, env.Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.gtmqhZw2K7/Render, project.build.sourceEncoding=UTF-8, env.DISPLAY=/private/tmp/com.apple.launchd.T8gATB7rP7/org.macosforge.xquartz:0, user.name=admin, maven.build.version=Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00), env.USER=admin, env.SHELL=/bin/bash, env.__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x1, env.PATH=/usr/bin:/bin:/usr/sbin:/sbin, user.language=fr, sun.boot.library.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib, classworlds.conf=/Users/admin/Application-Marwen/workspace/.metadata/.plugins/org.eclipse.m2e.launching/launches/m2conf2354967348069411789.tmp, env.XPC_FLAGS=0x0, java.version=1.8.0_77, user.timezone=Europe/Paris, sun.arch.data.model=64, http.nonProxyHosts=local|*.local|169.254/16|*.169.254/16, env.JAVA_MAIN_CLASS_886=org.codehaus.plexus.classworlds.launcher.Launcher, java.endorsed.dirs=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/endorsed, sun.cpu.isalist=, sun.jnu.encoding=UTF-8, file.encoding.pkg=sun.io, file.separator=/, java.specification.name=Java Platform API Specification, java.class.version=52.0, org.slf4j.simpleLogger.defaultLogLevel=debug, user.country=FR, java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre, java.vm.info=mixed mode, env.LOGNAME=admin, os.version=10.13.6, path.separator=:, java.vm.version=25.77-b03, java.awt.printerjob=sun.lwawt.macosx.CPrinterJob, version.war.plugin=2.1.1, sun.io.unicode.encoding=UnicodeBig, env.APP_ICON_791=../Resources/Eclipse.icns, awt.toolkit=sun.lwawt.macosx.LWCToolkit, socksNonProxyHosts=local|*.local|169.254/16|*.169.254/16, ftp.nonProxyHosts=local|*.local|169.254/16|*.169.254/16, user.home=/Users/admin, java.specification.vendor=Oracle Corporation, java.library.path=/Users/admin/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:., java.vendor.url=http://java.oracle.com/, node.directory=node, java.vm.vendor=Oracle Corporation, gopherProxySet=false, maven.home=/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/EMBEDDED, java.runtime.name=Java(TM) SE Runtime Environment, sun.java.command=org.codehaus.plexus.classworlds.launcher.Launcher -B -X -e -e clean install, java.class.path=/Applications/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.m2e.maven.runtime_1.8.3.20180227-2135/jars/plexus-classworlds-2.5.2.jar, maven.version=3.3.9, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.8, sun.cpu.endian=little, sun.os.patch.level=unknown, env.HOME=/Users/admin, java.io.tmpdir=/var/folders/cj/18nnbwrn68v72gpfnc09tpl80000gn/T/, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, maven.multiModuleProjectDirectory=/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web, env.SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.Cg1179KZLC/Listeners, os.arch=x86_64, java.awt.graphicsenv=sun.awt.CGraphicsEnvironment, java.ext.dirs=/Users/admin/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java, user.dir=/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web, line.separator=
, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, file.encoding=UTF-8, npm.executable=npm, java.specification.version=1.8}
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[DEBUG] resource with targetPath null
directory /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/src/main/resources
excludes []
includes []
[INFO] skip non existing resourceDirectory /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ tourism-web ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=2, ConflictMarker.markTime=1, ConflictMarker.nodeCount=160, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=43, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=3, ConflictResolver.conflictItemCount=63, DefaultDependencyCollector.collectTime=278, DefaultDependencyCollector.transformTime=6}
[DEBUG] org.apache.maven.plugins:maven-compiler-plugin:jar:3.1:
[DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-artifact:jar:2.0.9:compile
[DEBUG]       org.codehaus.plexus:plexus-utils:jar:1.5.1:compile
[DEBUG]    org.apache.maven:maven-core:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-settings:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-profile:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-model:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-repository-metadata:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-error-diagnostics:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-project:jar:2.0.9:compile
[DEBUG]          org.apache.maven:maven-plugin-registry:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-plugin-descriptor:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-artifact-manager:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-monitor:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-toolchain:jar:1.0:compile
[DEBUG]    org.apache.maven.shared:maven-shared-utils:jar:0.1:compile
[DEBUG]       com.google.code.findbugs:jsr305:jar:2.0.1:compile
[DEBUG]    org.apache.maven.shared:maven-shared-incremental:jar:1.1:compile
[DEBUG]       org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile
[DEBUG]    org.codehaus.plexus:plexus-compiler-api:jar:2.2:compile
[DEBUG]    org.codehaus.plexus:plexus-compiler-manager:jar:2.2:compile
[DEBUG]    org.codehaus.plexus:plexus-compiler-javac:jar:2.2:runtime
[DEBUG]    org.codehaus.plexus:plexus-container-default:jar:1.5.5:compile
[DEBUG]       org.codehaus.plexus:plexus-classworlds:jar:2.2.2:compile
[DEBUG]       org.apache.xbean:xbean-reflect:jar:3.4:compile
[DEBUG]          log4j:log4j:jar:1.2.12:compile
[DEBUG]          commons-logging:commons-logging-api:jar:1.1:compile
[DEBUG]       com.google.collections:google-collections:jar:1.0:compile
[DEBUG]       junit:junit:jar:3.8.2:compile
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-compiler-plugin:3.1
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-compiler-plugin:3.1
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-compiler-plugin:3.1
[DEBUG]   Included: org.apache.maven.plugins:maven-compiler-plugin:jar:3.1
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:1.5.1
[DEBUG]   Included: org.apache.maven.shared:maven-shared-utils:jar:0.1
[DEBUG]   Included: com.google.code.findbugs:jsr305:jar:2.0.1
[DEBUG]   Included: org.apache.maven.shared:maven-shared-incremental:jar:1.1
[DEBUG]   Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
[DEBUG]   Included: org.codehaus.plexus:plexus-compiler-api:jar:2.2
[DEBUG]   Included: org.codehaus.plexus:plexus-compiler-manager:jar:2.2
[DEBUG]   Included: org.codehaus.plexus:plexus-compiler-javac:jar:2.2
[DEBUG]   Included: org.apache.xbean:xbean-reflect:jar:3.4
[DEBUG]   Included: log4j:log4j:jar:1.2.12
[DEBUG]   Included: commons-logging:commons-logging-api:jar:1.1
[DEBUG]   Included: com.google.collections:google-collections:jar:1.0
[DEBUG]   Included: junit:junit:jar:3.8.2
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-compiler-plugin:3.1:compile from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-compiler-plugin:3.1, parent: sun.misc.Launcher$AppClassLoader@55f96302]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:3.1:compile' with basic configurator -->
[DEBUG]   (f) basedir = /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web
[DEBUG]   (f) buildDirectory = /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target
[DEBUG]   (f) classpathElements = [/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/classes]
[DEBUG]   (f) compileSourceRoots = [/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/src/main/java]
[DEBUG]   (f) compilerId = javac
[DEBUG]   (f) debug = true
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) failOnError = true
[DEBUG]   (f) forceJavacCompilerUse = false
[DEBUG]   (f) fork = false
[DEBUG]   (f) generatedSourcesDirectory = /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/generated-sources/annotations
[DEBUG]   (f) mojoExecution = org.apache.maven.plugins:maven-compiler-plugin:3.1:compile {execution: default-compile}
[DEBUG]   (f) optimize = false
[DEBUG]   (f) outputDirectory = /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/classes
[DEBUG]   (f) projectArtifact = tourism-guide-web:tourism-web:jar:1.0.0-SNAPSHOT
[DEBUG]   (f) showDeprecation = false
[DEBUG]   (f) showWarnings = false
[DEBUG]   (f) skipMultiThreadWarning = false
[DEBUG]   (f) source = 1.5
[DEBUG]   (f) staleMillis = 0
[DEBUG]   (f) target = 1.5
[DEBUG]   (f) useIncrementalCompilation = true
[DEBUG]   (f) verbose = false
[DEBUG]   (f) mavenSession = org.apache.maven.execution.MavenSession@439a8f59
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@439a8f59
[DEBUG] -- end configuration --
[DEBUG] Using compiler 'javac'.
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ tourism-web ---
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-resources-plugin:2.4.3:testResources from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-resources-plugin:2.4.3, parent: sun.misc.Launcher$AppClassLoader@55f96302]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-resources-plugin:2.4.3:testResources' with basic configurator -->
[DEBUG]   (f) buildFilters = []
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) escapeWindowsPaths = true
[DEBUG]   (s) includeEmptyDirs = false
[DEBUG]   (s) outputDirectory = /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/test-classes
[DEBUG]   (s) overwrite = false
[DEBUG]   (f) project = MavenProject: tourism-guide-web:tourism-web:1.0.0-SNAPSHOT @ /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/pom.xml
[DEBUG]   (s) resources = [Resource {targetPath: null, filtering: false, FileSet {directory: /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/src/test/resources, PatternSet [includes: {}, excludes: {}]}}]
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@439a8f59
[DEBUG]   (f) useBuildFilters = true
[DEBUG]   (s) useDefaultDelimiters = true
[DEBUG] -- end configuration --
[DEBUG] properties used {java.vendor=Oracle Corporation, sun.java.launcher=SUN_STANDARD, env.XPC_SERVICE_NAME=org.eclipse.platform.ide.1804, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, env.JAVA_STARTED_ON_FIRST_THREAD_791=1, os.name=Mac OS X, sun.boot.class.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/classes, env.TMPDIR=/var/folders/cj/18nnbwrn68v72gpfnc09tpl80000gn/T/, java.vm.specification.vendor=Oracle Corporation, java.runtime.version=1.8.0_77-b03, env.Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.gtmqhZw2K7/Render, project.build.sourceEncoding=UTF-8, env.DISPLAY=/private/tmp/com.apple.launchd.T8gATB7rP7/org.macosforge.xquartz:0, user.name=admin, maven.build.version=Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00), env.USER=admin, env.SHELL=/bin/bash, env.__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x1, env.PATH=/usr/bin:/bin:/usr/sbin:/sbin, user.language=fr, sun.boot.library.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib, classworlds.conf=/Users/admin/Application-Marwen/workspace/.metadata/.plugins/org.eclipse.m2e.launching/launches/m2conf2354967348069411789.tmp, env.XPC_FLAGS=0x0, java.version=1.8.0_77, user.timezone=Europe/Paris, sun.arch.data.model=64, http.nonProxyHosts=local|*.local|169.254/16|*.169.254/16, env.JAVA_MAIN_CLASS_886=org.codehaus.plexus.classworlds.launcher.Launcher, java.endorsed.dirs=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/endorsed, sun.cpu.isalist=, sun.jnu.encoding=UTF-8, file.encoding.pkg=sun.io, file.separator=/, java.specification.name=Java Platform API Specification, java.class.version=52.0, org.slf4j.simpleLogger.defaultLogLevel=debug, user.country=FR, java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre, java.vm.info=mixed mode, env.LOGNAME=admin, os.version=10.13.6, path.separator=:, java.vm.version=25.77-b03, java.awt.printerjob=sun.lwawt.macosx.CPrinterJob, version.war.plugin=2.1.1, sun.io.unicode.encoding=UnicodeBig, env.APP_ICON_791=../Resources/Eclipse.icns, awt.toolkit=sun.lwawt.macosx.LWCToolkit, socksNonProxyHosts=local|*.local|169.254/16|*.169.254/16, ftp.nonProxyHosts=local|*.local|169.254/16|*.169.254/16, user.home=/Users/admin, java.specification.vendor=Oracle Corporation, java.library.path=/Users/admin/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:., java.vendor.url=http://java.oracle.com/, node.directory=node, java.vm.vendor=Oracle Corporation, gopherProxySet=false, maven.home=/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/EMBEDDED, java.runtime.name=Java(TM) SE Runtime Environment, sun.java.command=org.codehaus.plexus.classworlds.launcher.Launcher -B -X -e -e clean install, java.class.path=/Applications/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.m2e.maven.runtime_1.8.3.20180227-2135/jars/plexus-classworlds-2.5.2.jar, maven.version=3.3.9, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.8, sun.cpu.endian=little, sun.os.patch.level=unknown, env.HOME=/Users/admin, java.io.tmpdir=/var/folders/cj/18nnbwrn68v72gpfnc09tpl80000gn/T/, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, maven.multiModuleProjectDirectory=/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web, env.SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.Cg1179KZLC/Listeners, os.arch=x86_64, java.awt.graphicsenv=sun.awt.CGraphicsEnvironment, java.ext.dirs=/Users/admin/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java, user.dir=/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web, line.separator=
, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, file.encoding=UTF-8, npm.executable=npm, java.specification.version=1.8}
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[DEBUG] resource with targetPath null
directory /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/src/test/resources
excludes []
includes []
[INFO] skip non existing resourceDirectory /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ tourism-web ---
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-compiler-plugin:3.1, parent: sun.misc.Launcher$AppClassLoader@55f96302]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile' with basic configurator -->
[DEBUG]   (f) basedir = /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web
[DEBUG]   (f) buildDirectory = /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target
[DEBUG]   (f) classpathElements = [/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/test-classes, /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/classes]
[DEBUG]   (f) compileSourceRoots = [/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/src/test/java]
[DEBUG]   (f) compilerId = javac
[DEBUG]   (f) debug = true
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) failOnError = true
[DEBUG]   (f) forceJavacCompilerUse = false
[DEBUG]   (f) fork = false
[DEBUG]   (f) generatedTestSourcesDirectory = /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/generated-test-sources/test-annotations
[DEBUG]   (f) mojoExecution = org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile {execution: default-testCompile}
[DEBUG]   (f) optimize = false
[DEBUG]   (f) outputDirectory = /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/test-classes
[DEBUG]   (f) showDeprecation = false
[DEBUG]   (f) showWarnings = false
[DEBUG]   (f) skipMultiThreadWarning = false
[DEBUG]   (f) source = 1.5
[DEBUG]   (f) staleMillis = 0
[DEBUG]   (f) target = 1.5
[DEBUG]   (f) useIncrementalCompilation = true
[DEBUG]   (f) verbose = false
[DEBUG]   (f) mavenSession = org.apache.maven.execution.MavenSession@439a8f59
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@439a8f59
[DEBUG] -- end configuration --
[DEBUG] Using compiler 'javac'.
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.20.1:test (default-test) @ tourism-web ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=111, ConflictIdSorter.graphTime=1, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=34, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2, ConflictResolver.conflictItemCount=76, DefaultDependencyCollector.collectTime=75, DefaultDependencyCollector.transformTime=3}
[DEBUG] org.apache.maven.plugins:maven-surefire-plugin:jar:2.20.1:
[DEBUG]    org.apache.maven.surefire:maven-surefire-common:jar:2.20.1:compile
[DEBUG]       org.apache.maven:maven-plugin-api:jar:2.2.1:compile
[DEBUG]       org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.3:compile
[DEBUG]       org.apache.maven.surefire:surefire-api:jar:2.20.1:compile
.......................................
.......................................




Checking for jar manifest virtual files...



[INFO] Building jar: /Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/tourism-web-1.0.0-SNAPSHOT.jar
[DEBUG] adding directory META-INF/
[DEBUG] adding entry META-INF/MANIFEST.MF
[INFO] 

1 个答案:

答案 0 :(得分:1)

根据用户的建议,我做了几件事 我更新了我给的pom.xml的摘录

        <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <version>1.6</version>
            <configuration>
                <workingDirectory>src/main/angular5/tourism</workingDirectory>
                <!-- where to install npm -->
                <installDirectory>temp</installDirectory>
            </configuration>                
            <executions>
                <execution>
                    <id>install node and npm</id>
                    <goals>
                        <goal>install-node-and-npm</goal>
                    </goals>
                    <phase>generate-resources</phase>
                    <configuration>
                        <nodeVersion>v8.11.3</nodeVersion>
                        <npmVersion>6.3.0</npmVersion>                      
                    </configuration>                        
                </execution>
                <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <!-- Optional configuration which provides for running any npm command -->
                        <configuration>
                            <arguments>install</arguments>
                        </configuration>
                 </execution>
                 <execution>
                     <id>prod</id>
                     <goals>
                       <goal>npm</goal>
                     </goals>
                     <configuration>
                       <arguments>run-script build</arguments>
                     </configuration>
                     <phase>generate-resources</phase>
                  </execution>                                                      
            </executions>
        </plugin>

最后,我没有在编译文件dist文件夹中获得所需的内容 enter image description here

例如,我看不到应用程序文件夹的所有编译文件

我在互联网上找到了应有的例子

enter image description here

此外,最终目标是生成一个zip文件,其中包含我将嵌入到war文件中的所有有角度的项目资源和资源(由包含Web服务的maven子模块项目生成) 但是,我看不到在哪里以及如何嵌入角度依赖项(或库)(即在package.json文件的dependencies属性下列出的所有依赖项) 这是package.json文件的一部分

{
  "name": "tourism",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.3",
    "@angular/common": "^6.0.3",
    "@angular/compiler": "^6.0.3",
    "@angular/core": "^6.0.3",
    "@angular/forms": "^6.0.3",
    "@angular/http": "^6.0.3",
    "@angular/platform-browser": "^6.0.3",
    "@angular/platform-browser-dynamic": "^6.0.3",
    "@angular/router": "^6.0.3",
    "core-js": "^2.5.4",
    "rxjs": "^6.0.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^6.0.3",
    "@angular-devkit/build-angular": "~0.6.8",
    "typescript": "~2.7.2",
    "@angular/cli": "~6.0.8",
    "@angular/language-service": "^6.0.3",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",

此外,我注意到从dist文件夹中获得的内容,并且与在Internet上找到的内容进行比较时,我想知道是否需要以下文件:

-main.js.map
-polyfills.js
-polyfills.js.map
-runtime.js
-runtime.js.map
-style.js
styles.js.map

如果可以的话,请提取angular.json文件

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "tourism": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.css"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "tourism:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "tourism:build:production"
            }
          }

这是我的tsconfig.app.json文件

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "module": "es2015",
    "types": []
  },
  "exclude": [
    "src/test.ts",
    "**/*.spec.ts"
  ]
}

这是我的tsconfig.json文件

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./src",
    "outDir": "./dist",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}

以下是Maven日志

[INFO] > ng build
[INFO] 
[INFO] 
[INFO] [0mDate: [1m[37m2018-09-03T12:53:22.792Z[39m[22m[0m
[INFO] [0mHash: [1m[37m4e040e480b1db9055f1d[39m[22m[0m
[INFO] [0mTime: [1m[37m12939[39m[22mms[0m
[INFO] [0mchunk {[1m[33mmain[39m[22m} [1m[32mmain.js, main.js.map[39m[22m (main) 8.32 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[INFO] [0mchunk {[1m[33mpolyfills[39m[22m} [1m[32mpolyfills.js, polyfills.js.map[39m[22m (polyfills) 226 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[INFO] [0mchunk {[1m[33mruntime[39m[22m} [1m[32mruntime.js, runtime.js.map[39m[22m (runtime) 5.22 kB [1m[33m[entry][39m[22m[1m[32m [rendered][39m[22m[0m
[INFO] [0mchunk {[1m[33mstyles[39m[22m} [1m[32mstyles.js, styles.js.map[39m[22m (styles) 15.7 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[INFO] [0mchunk {[1m[33mvendor[39m[22m} [1m[32mvendor.js, vendor.js.map[39m[22m (vendor) 2.74 MB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[DEBUG] Exit value 0

我试图在命令行上执行:我得到了相同的结果