zip a file with maven to a NO java application directory
I don´t know if this is possible . This is what I want to do.
I have some jenkins pipelines that build a VUE.js application using node js.
using the "nmp run build" command. The result of this build, is the directory name "Static" and a index.html file. After that I zip those 2 into a file.zip which I upload to Artifactory, so later it can be downloaded unziped and put it into a docker file to build an image and later a container in azure (ACI).
I want to implement some versioning now of those zips which I already done with other apps but in Java with maven + POM + Maven+Metadata+Plugin + jenkins+ artifactory where I have 2 jobs. 1 job to build with maven and push to artifactory the file.war, and other job to choose the file.war from artifactory with "build with parameters" option.
I read something about using also maven for creating a zip file even though is not a java app here and do the same for node js.
So, Is it possible with maven to zip a directory and a file even thought they are not a java app and include job number to version this zip file and pushing into artifactory?, if not, which is the best approach to do the same as I did with Java and maven for versioning, but for VUE.js applications in a jenkins pipeline that push a zip along with build number into artifactory and then using the "build with parameters" option to choose the zip I want?
thank you!
node.js maven jenkins vue.js artifactory
add a comment |
I don´t know if this is possible . This is what I want to do.
I have some jenkins pipelines that build a VUE.js application using node js.
using the "nmp run build" command. The result of this build, is the directory name "Static" and a index.html file. After that I zip those 2 into a file.zip which I upload to Artifactory, so later it can be downloaded unziped and put it into a docker file to build an image and later a container in azure (ACI).
I want to implement some versioning now of those zips which I already done with other apps but in Java with maven + POM + Maven+Metadata+Plugin + jenkins+ artifactory where I have 2 jobs. 1 job to build with maven and push to artifactory the file.war, and other job to choose the file.war from artifactory with "build with parameters" option.
I read something about using also maven for creating a zip file even though is not a java app here and do the same for node js.
So, Is it possible with maven to zip a directory and a file even thought they are not a java app and include job number to version this zip file and pushing into artifactory?, if not, which is the best approach to do the same as I did with Java and maven for versioning, but for VUE.js applications in a jenkins pipeline that push a zip along with build number into artifactory and then using the "build with parameters" option to choose the zip I want?
thank you!
node.js maven jenkins vue.js artifactory
add a comment |
I don´t know if this is possible . This is what I want to do.
I have some jenkins pipelines that build a VUE.js application using node js.
using the "nmp run build" command. The result of this build, is the directory name "Static" and a index.html file. After that I zip those 2 into a file.zip which I upload to Artifactory, so later it can be downloaded unziped and put it into a docker file to build an image and later a container in azure (ACI).
I want to implement some versioning now of those zips which I already done with other apps but in Java with maven + POM + Maven+Metadata+Plugin + jenkins+ artifactory where I have 2 jobs. 1 job to build with maven and push to artifactory the file.war, and other job to choose the file.war from artifactory with "build with parameters" option.
I read something about using also maven for creating a zip file even though is not a java app here and do the same for node js.
So, Is it possible with maven to zip a directory and a file even thought they are not a java app and include job number to version this zip file and pushing into artifactory?, if not, which is the best approach to do the same as I did with Java and maven for versioning, but for VUE.js applications in a jenkins pipeline that push a zip along with build number into artifactory and then using the "build with parameters" option to choose the zip I want?
thank you!
node.js maven jenkins vue.js artifactory
I don´t know if this is possible . This is what I want to do.
I have some jenkins pipelines that build a VUE.js application using node js.
using the "nmp run build" command. The result of this build, is the directory name "Static" and a index.html file. After that I zip those 2 into a file.zip which I upload to Artifactory, so later it can be downloaded unziped and put it into a docker file to build an image and later a container in azure (ACI).
I want to implement some versioning now of those zips which I already done with other apps but in Java with maven + POM + Maven+Metadata+Plugin + jenkins+ artifactory where I have 2 jobs. 1 job to build with maven and push to artifactory the file.war, and other job to choose the file.war from artifactory with "build with parameters" option.
I read something about using also maven for creating a zip file even though is not a java app here and do the same for node js.
So, Is it possible with maven to zip a directory and a file even thought they are not a java app and include job number to version this zip file and pushing into artifactory?, if not, which is the best approach to do the same as I did with Java and maven for versioning, but for VUE.js applications in a jenkins pipeline that push a zip along with build number into artifactory and then using the "build with parameters" option to choose the zip I want?
thank you!
node.js maven jenkins vue.js artifactory
node.js maven jenkins vue.js artifactory
asked Nov 20 '18 at 19:04
ValebianValebian
128314
128314
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You mentioned, that you are already using npm to build your Vue app. There are libraries for npm available for zipping. You could e.g. do something like this:
const fs = require('fs');
const archiver = require('archiver');
const archive = archiver('zip', {
zlib: { level: 9 }
});
const filename = "./output.zip";
const fileOutput = fs.createWriteStream(filename);
fileOutput.on('close', function() {
console.info('ZIP file created. ' + archive.pointer() + ' total Bytes.');
});
archive.pipe(fileOutput);
archive.directory('./input-directory', '/');
archive.on('error', function(error) {
throw error;
});
archive.finalize();
This assumes, that the output of your build process is stored in a dist
folder on your file system and that you have access to the filesystem.
There are more examples of archiver
in the official docs: https://github.com/archiverjs/node-archiver
yes but does this have any kind of integration with jenkins and artifactory for work with some versioning? same as maven?
– Valebian
Nov 21 '18 at 12:04
add a comment |
You may build a zip file using the maven-assembly-plugin with an assembly descriptor.
The assembly descriptor goes in the project's src/assembly
directory, named something like my-zip-format.xml
. You'll need to customize the content to include the files needed but this is the idea.
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>my-zip</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>path/to/input/dir</directory>
<outputDirectory>name-of-output-dir</outputDirectory>
<directoryMode>0750</directoryMode>
<fileMode>0640</fileMode>
<lineEnding>unix</lineEnding>
</fileSet>
</fileSets>
</assembly>
Then, tell the POM to use the assembly:
....
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version><pluginVersionHere></version>
<executions>
<execution>
<id>make-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/my-zip-format.xml</descriptor>
</descriptors>
</configuration>
...
Documentation goes into a lot more detail, and there are plenty of SO questions/answers about assembly plugin nuances as well.
yes I read tha,t so basically I need to create and add in the directory that contain the static directoy and the index.html a POM file and the and the zip.xml I guess and ALL THAT put them into a directory named src/assembly ? Or the directory name is not important? just adding the pom and the zip.xml among Static folder and index.html?....
– Valebian
Nov 21 '18 at 15:13
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53399861%2fzip-a-file-with-maven-to-a-no-java-application-directory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You mentioned, that you are already using npm to build your Vue app. There are libraries for npm available for zipping. You could e.g. do something like this:
const fs = require('fs');
const archiver = require('archiver');
const archive = archiver('zip', {
zlib: { level: 9 }
});
const filename = "./output.zip";
const fileOutput = fs.createWriteStream(filename);
fileOutput.on('close', function() {
console.info('ZIP file created. ' + archive.pointer() + ' total Bytes.');
});
archive.pipe(fileOutput);
archive.directory('./input-directory', '/');
archive.on('error', function(error) {
throw error;
});
archive.finalize();
This assumes, that the output of your build process is stored in a dist
folder on your file system and that you have access to the filesystem.
There are more examples of archiver
in the official docs: https://github.com/archiverjs/node-archiver
yes but does this have any kind of integration with jenkins and artifactory for work with some versioning? same as maven?
– Valebian
Nov 21 '18 at 12:04
add a comment |
You mentioned, that you are already using npm to build your Vue app. There are libraries for npm available for zipping. You could e.g. do something like this:
const fs = require('fs');
const archiver = require('archiver');
const archive = archiver('zip', {
zlib: { level: 9 }
});
const filename = "./output.zip";
const fileOutput = fs.createWriteStream(filename);
fileOutput.on('close', function() {
console.info('ZIP file created. ' + archive.pointer() + ' total Bytes.');
});
archive.pipe(fileOutput);
archive.directory('./input-directory', '/');
archive.on('error', function(error) {
throw error;
});
archive.finalize();
This assumes, that the output of your build process is stored in a dist
folder on your file system and that you have access to the filesystem.
There are more examples of archiver
in the official docs: https://github.com/archiverjs/node-archiver
yes but does this have any kind of integration with jenkins and artifactory for work with some versioning? same as maven?
– Valebian
Nov 21 '18 at 12:04
add a comment |
You mentioned, that you are already using npm to build your Vue app. There are libraries for npm available for zipping. You could e.g. do something like this:
const fs = require('fs');
const archiver = require('archiver');
const archive = archiver('zip', {
zlib: { level: 9 }
});
const filename = "./output.zip";
const fileOutput = fs.createWriteStream(filename);
fileOutput.on('close', function() {
console.info('ZIP file created. ' + archive.pointer() + ' total Bytes.');
});
archive.pipe(fileOutput);
archive.directory('./input-directory', '/');
archive.on('error', function(error) {
throw error;
});
archive.finalize();
This assumes, that the output of your build process is stored in a dist
folder on your file system and that you have access to the filesystem.
There are more examples of archiver
in the official docs: https://github.com/archiverjs/node-archiver
You mentioned, that you are already using npm to build your Vue app. There are libraries for npm available for zipping. You could e.g. do something like this:
const fs = require('fs');
const archiver = require('archiver');
const archive = archiver('zip', {
zlib: { level: 9 }
});
const filename = "./output.zip";
const fileOutput = fs.createWriteStream(filename);
fileOutput.on('close', function() {
console.info('ZIP file created. ' + archive.pointer() + ' total Bytes.');
});
archive.pipe(fileOutput);
archive.directory('./input-directory', '/');
archive.on('error', function(error) {
throw error;
});
archive.finalize();
This assumes, that the output of your build process is stored in a dist
folder on your file system and that you have access to the filesystem.
There are more examples of archiver
in the official docs: https://github.com/archiverjs/node-archiver
answered Nov 21 '18 at 11:49
ssc-hrep3ssc-hrep3
5,25731656
5,25731656
yes but does this have any kind of integration with jenkins and artifactory for work with some versioning? same as maven?
– Valebian
Nov 21 '18 at 12:04
add a comment |
yes but does this have any kind of integration with jenkins and artifactory for work with some versioning? same as maven?
– Valebian
Nov 21 '18 at 12:04
yes but does this have any kind of integration with jenkins and artifactory for work with some versioning? same as maven?
– Valebian
Nov 21 '18 at 12:04
yes but does this have any kind of integration with jenkins and artifactory for work with some versioning? same as maven?
– Valebian
Nov 21 '18 at 12:04
add a comment |
You may build a zip file using the maven-assembly-plugin with an assembly descriptor.
The assembly descriptor goes in the project's src/assembly
directory, named something like my-zip-format.xml
. You'll need to customize the content to include the files needed but this is the idea.
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>my-zip</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>path/to/input/dir</directory>
<outputDirectory>name-of-output-dir</outputDirectory>
<directoryMode>0750</directoryMode>
<fileMode>0640</fileMode>
<lineEnding>unix</lineEnding>
</fileSet>
</fileSets>
</assembly>
Then, tell the POM to use the assembly:
....
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version><pluginVersionHere></version>
<executions>
<execution>
<id>make-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/my-zip-format.xml</descriptor>
</descriptors>
</configuration>
...
Documentation goes into a lot more detail, and there are plenty of SO questions/answers about assembly plugin nuances as well.
yes I read tha,t so basically I need to create and add in the directory that contain the static directoy and the index.html a POM file and the and the zip.xml I guess and ALL THAT put them into a directory named src/assembly ? Or the directory name is not important? just adding the pom and the zip.xml among Static folder and index.html?....
– Valebian
Nov 21 '18 at 15:13
add a comment |
You may build a zip file using the maven-assembly-plugin with an assembly descriptor.
The assembly descriptor goes in the project's src/assembly
directory, named something like my-zip-format.xml
. You'll need to customize the content to include the files needed but this is the idea.
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>my-zip</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>path/to/input/dir</directory>
<outputDirectory>name-of-output-dir</outputDirectory>
<directoryMode>0750</directoryMode>
<fileMode>0640</fileMode>
<lineEnding>unix</lineEnding>
</fileSet>
</fileSets>
</assembly>
Then, tell the POM to use the assembly:
....
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version><pluginVersionHere></version>
<executions>
<execution>
<id>make-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/my-zip-format.xml</descriptor>
</descriptors>
</configuration>
...
Documentation goes into a lot more detail, and there are plenty of SO questions/answers about assembly plugin nuances as well.
yes I read tha,t so basically I need to create and add in the directory that contain the static directoy and the index.html a POM file and the and the zip.xml I guess and ALL THAT put them into a directory named src/assembly ? Or the directory name is not important? just adding the pom and the zip.xml among Static folder and index.html?....
– Valebian
Nov 21 '18 at 15:13
add a comment |
You may build a zip file using the maven-assembly-plugin with an assembly descriptor.
The assembly descriptor goes in the project's src/assembly
directory, named something like my-zip-format.xml
. You'll need to customize the content to include the files needed but this is the idea.
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>my-zip</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>path/to/input/dir</directory>
<outputDirectory>name-of-output-dir</outputDirectory>
<directoryMode>0750</directoryMode>
<fileMode>0640</fileMode>
<lineEnding>unix</lineEnding>
</fileSet>
</fileSets>
</assembly>
Then, tell the POM to use the assembly:
....
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version><pluginVersionHere></version>
<executions>
<execution>
<id>make-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/my-zip-format.xml</descriptor>
</descriptors>
</configuration>
...
Documentation goes into a lot more detail, and there are plenty of SO questions/answers about assembly plugin nuances as well.
You may build a zip file using the maven-assembly-plugin with an assembly descriptor.
The assembly descriptor goes in the project's src/assembly
directory, named something like my-zip-format.xml
. You'll need to customize the content to include the files needed but this is the idea.
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>my-zip</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>path/to/input/dir</directory>
<outputDirectory>name-of-output-dir</outputDirectory>
<directoryMode>0750</directoryMode>
<fileMode>0640</fileMode>
<lineEnding>unix</lineEnding>
</fileSet>
</fileSets>
</assembly>
Then, tell the POM to use the assembly:
....
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version><pluginVersionHere></version>
<executions>
<execution>
<id>make-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/my-zip-format.xml</descriptor>
</descriptors>
</configuration>
...
Documentation goes into a lot more detail, and there are plenty of SO questions/answers about assembly plugin nuances as well.
answered Nov 21 '18 at 13:47
user944849user944849
10.4k14262
10.4k14262
yes I read tha,t so basically I need to create and add in the directory that contain the static directoy and the index.html a POM file and the and the zip.xml I guess and ALL THAT put them into a directory named src/assembly ? Or the directory name is not important? just adding the pom and the zip.xml among Static folder and index.html?....
– Valebian
Nov 21 '18 at 15:13
add a comment |
yes I read tha,t so basically I need to create and add in the directory that contain the static directoy and the index.html a POM file and the and the zip.xml I guess and ALL THAT put them into a directory named src/assembly ? Or the directory name is not important? just adding the pom and the zip.xml among Static folder and index.html?....
– Valebian
Nov 21 '18 at 15:13
yes I read tha,t so basically I need to create and add in the directory that contain the static directoy and the index.html a POM file and the and the zip.xml I guess and ALL THAT put them into a directory named src/assembly ? Or the directory name is not important? just adding the pom and the zip.xml among Static folder and index.html?....
– Valebian
Nov 21 '18 at 15:13
yes I read tha,t so basically I need to create and add in the directory that contain the static directoy and the index.html a POM file and the and the zip.xml I guess and ALL THAT put them into a directory named src/assembly ? Or the directory name is not important? just adding the pom and the zip.xml among Static folder and index.html?....
– Valebian
Nov 21 '18 at 15:13
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53399861%2fzip-a-file-with-maven-to-a-no-java-application-directory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown