我建立了一个反应应用程序使用创建-反应-应用程序。
生产建设是通过以下方式在Jenkins完成的:
npm install --prod npm run build
然后我就有了“准备部署”神器。
但是我怎样才能在我的Nexus上得到这个神器呢?
我可以使用package.json的版本吗?
在上传之前,我需要自己做一个拉链或者类似的东西吗?
这将是相当不错的历史,它将更容易/更快地从工件上构建码头比再次构建更容易。
你们是怎么解决的?谢谢你的回答。
发布于 2022-04-01 12:19:28
我知道这个问题很老,但它可能会对别人有所帮助。
我最近不得不做一些类似的事情。我的做法是:
pom.xml
中配置私有存储库 <distributionManagement>
<snapshotRepository>
<id>RepoId</id>
<url>http://.../repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>RepoId</id>
<url>http://.../repositories/releases/</url>
</repository>
</distributionManagement>
build
目录 <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>build</directory>
<includes>
<include>**/*</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.12.1</version>
<executions>
<!-- install node & yarn -->
<execution>
<id>install node and yarn</id>
<goals>
<goal>install-node-and-yarn</goal>
</goals>
<configuration>
<nodeVersion>v16.13.0</nodeVersion>
<yarnVersion>v1.22.17</yarnVersion>
</configuration>
</execution>
<!-- yarn install -->
<execution>
<id>yarn install</id>
<goals>
<goal>yarn</goal>
</goals>
</execution>
<!-- yarn run build -->
<execution>
<id>yarn run build</id>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
build
目录下的所有内容打包到zip文件中。 <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<!-- pack everything under /build into a zip -->
<execution>
<id>create-distribution</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
其中assembly.xml
看起来像:
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<outputDirectory>/</outputDirectory>
<directory>build</directory>
</fileSet>
</fileSets>
</assembly>
mvn clean deploy
以便将zip文件上传到nexus。此外,我发现这个解决方案用于同步package.json
版本和pom.xml
版本,但我没有使用它。
https://stackoverflow.com/questions/53766588
复制相似问题