在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):smh/grunt-maven-tasks开源软件地址(OpenSource Url):https://github.com/smh/grunt-maven-tasks开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):grunt-maven-tasks
Getting StartedThis plugin requires Grunt If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: npm install grunt-maven-tasks --save-dev Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: grunt.loadNpmTasks('grunt-maven-tasks'); Supported Maven Goalsno goalIf no goal is specified, the goal will be set to the target name. This means that the target name must be one of packageRun the This tasks packages an artifact. installRun the This tasks packages and installs an artifact to your local maven repository. deployRun the This tasks packages and deploys an artifact to a maven repository. release taskRun the This task packages and releases an artifact to a maven repository. It will update the version number in the package.json file to the next development version, and, if this is a git project, it will commit and tag the release. By default, it will increment the version number using the Run this task with the Run this task with the Run this task with the OverviewIn your project's Gruntfile, add a section named grunt.initConfig({
maven: {
options: {
goal: 'deploy',
groupId: 'com.example',
url: '<repository-url>',
},
src: [ '**', '!node_modules/**' ]
}
}) Optionsoptions.versionFileType Identifies the file that contains the version file to read. (E.G. bower.json) options.goalType The maven goal for the target artifact. Valid values are 'deploy' and 'release'. Defaults to the target name options.groupIdType: The maven group id to use when deploying and artifact options.artifactIdType: The maven artifact id to use when deploying and artifact options.versionType: The version to use when deploying to the maven repository options.classifierType: The classifier to use when deploying to the maven repository options.uniqueVersionType: Allow to generate timestamped artifacts. options.modeType: The mode passed to semver.inc to determine next development version. options.packagingType: The packaging to use when deploying to the maven repository. Will also determine the archiving type. As internally the grunt-contrib-compress plugin is used to package the artifact, only archiving types supported by this module is supported. options.urlType: The url for the maven repository to deploy to. options.repositoryIdType: The repository id of the repository to deploy to. Used for looking up authentication in settings.xml. options.typeType: Enables you to choose a different file extension for your artifact besides .zip which is useful when using the Maven WAR-plugin options.injectDestFolderType: Enables you to turn off the injection of destination folder inside your artifact allowing you to choose the structure you want by configuring the compress task. options.destFolderType: Specifies the name of the folder to be injected inside the artifact. If not specified, this will be auto-generated. options.commitPrefixType: Prefix for the commit message when releasing. options.gitpushType: If options.gitpushtagType: If options.unsecureType: If options.settingsXmlType: Specifies the settings.xml file for options.optionalParamsType: Appends more optional parameters for FilesFiles may be specified using any of the supported Grunt file mapping formats. Usage ExamplesDefault OptionsIn this example, only required options have been specified and the 'goal' is defaulted to the target name. Running Running grunt.initConfig({
maven: {
options: { groupId: 'com.example' },
'package': {
options: {
goal: 'package'
},
src: [ '**', '!node_modules/**' ]
},
deploy: {
options: {
goal: 'deploy',
url: 'file://snapshot-repo'
},
src: [ '**', '!node_modules/**' ]
},
release: {
options: {
goal: 'release',
url: 'file://release-repo'
},
src: [ '**', '!node_modules/**' ]
}
}
})
grunt.registerTask('package', [ 'clean', 'test', 'maven:package' ]);
grunt.registerTask('deploy', [ 'clean', 'test', 'maven:deploy' ]);
grunt.registerTask('release', [ 'clean', 'test', 'maven:release' ]); The grunt.initConfig({
maven: {
deployA: {
options: {
goal: 'deploy',
groupId: 'com.example',
artifactId: 'myNodeArtifact',
url: '<repository-url>',
},
src: [ '**', '!node_modules/**' ]
},
deployB: {
options: {
goal: 'deploy',
groupId: 'com.example',
artifactId: 'myBrowserArtifact',
url: '<repository-url>',
},
src: [ 'target/browser/**', '!target/browser/node_modules/**' ]
}
}
}) Custom OptionsIn this example, the artifactId has been explicitly set, and the version bumping used when releasing is set to grunt.initConfig({
maven: {
options: { groupId: 'com.example', artifactId: 'example-project' },
deploy: {
options: { url: 'file://snapshot-repo' },
src: [ '**', '!node_modules/**' ]
},
release: {
options: { url: 'file://release-repo', mode: 'patch' },
src: [ '**', '!node_modules/**' ]
}
}
}) In order to customize the output archive, please look at the documenations for the grunt-contrib-compress task. ContributingIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论