当前位置: 首页 > news >正文

Mendix中的依赖管理:npm和Maven的应用

序言

在传统java开发项目中,我们可以利用maven来管理jar包依赖,但在mendix项目开发Custom Java Action时,由于目录结构有一些差异,我们需要自行配置。同样的,在mendix项目开发Custom JavaScript Action时,我们也希望可以安装npm依赖从而自动构建进js bundle文件中,而不是通过script标签在index.html中引用。那么接下来我们就分别介绍这两种方案吧!

完整示例

https://gitee.com/engalar/mendix-debugger-demo

后端依赖管理(maven)

配置文件

{项目目录}/pom.xml

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.mxcn</groupId><artifactId>DataImport</artifactId><version>1.1.0</version><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><executions><execution><id>copy-dependencies</id><goals><goal>copy-dependencies</goal></goals><configuration><outputDirectory>${project.basedir}/userlib</outputDirectory><overWriteReleases>false</overWriteReleases><overWriteSnapshots>false</overWriteSnapshots><overWriteIfNewer>true</overWriteIfNewer><excludeGroupIds>com.mendix</excludeGroupIds></configuration></execution></executions></plugin></plugins></build><dependencies><dependency><groupId>com.github.javafaker</groupId><artifactId>javafaker</artifactId><version>1.0.2</version></dependency><!-- 此处添加你需要的jar包依赖 --></dependencies><pluginRepositories><pluginRepository><id>aliyun-plugin</id><url>https://maven.aliyun.com/repository/central</url></pluginRepository></pluginRepositories><repositories><repository><id>aliyun-central</id><name>aliyun central</name><url>https://maven.aliyun.com/repository/central</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></repository></repositories></project>

接下来我们只需要把我们项目的依赖填入即可,如

<dependencies><dependency><groupId>com.github.javafaker</groupId><artifactId>javafaker</artifactId><version>1.0.2</version></dependency><!-- 此处添加你需要的jar包依赖 --></dependencies>

执行依赖安装

mvn compile

确保我们安装了mvn和jdk8,详细安装可以参考 https://www.runoob.com/maven/maven-setup.html

一切顺利我们就可以看到相应的依赖被下载到mendix期望的目录{项目目录}/userlib中了。

前端依赖管理(npm)

image.png

使用场景

我们新建了一个JavaScript Action LuckysheetRender,需要用到mobx这个npm包做状态管理

安装过程

  • 安装node,参考 https://www.runoob.com/nodejs/nodejs-install-setup.html
  • cd到LuckysheetRender所在的模块JavaScript源码目录,即{项目目录}/javascriptsource/luckysheet
  • npm install mobx

使用

安装之后就可以在js代码中import了。

关于Mendix公司

在一个数字化先行的世界中,客户希望自己的每一项需求都得到满足,员工希望使用更好的工具来完成工作,而企业意识到自己只有通过全面数字化转型才能生存并取得成功。Mendix,a Siemens business正在迅速成为企业数字化转型的推动者。Mendix公司是权威行业分析师眼中的领导者和远见者,从人工智能和增强现实,到智能自动化和原生移动,Mendix公司已成为数字化先行企业的骨干。Mendix公司企业低代码平台已被全球4000多家领先的公司采用。

http://www.lryc.cn/news/178292.html

相关文章:

  • 自定义hooks之useLastState、useSafeState
  • 前端判断: []+[], []+{}, {}+[], {}+{}
  • el-input-number/el-input 实现实时输入数字转换千分位(失焦时展示千分位)
  • 一篇博客学会系列(2)—— C语言中的自定义类型 :结构体、位段、枚举、联合体
  • KongA 任意用户登录漏洞分析
  • 吉力宝:智能科技鞋品牌步力宝引领传统产业创新思维
  • 【IPC 通信】信号处理接口 Signal API(1)
  • 使用GDIView排查GDI对象泄漏导致的程序UI界面绘制异常问题
  • 蓝桥等考Python组别一级001
  • Unity之Hololens2开发 如何接入的MRTK OpenXR Plugin
  • Ubuntu系统Linux内核安装和使用
  • 数学术语之源——群同态的“核(kernel)”
  • defcon-quals 2023 crackme.tscript.dso wp
  • 前端开发 vs. 后端开发:编程之路的选择
  • 算法练习4——删除有序数组中的重复项 II
  • 【C++进阶(六)】STL大法--栈和队列深度剖析优先级队列适配器原理
  • linux opensuse使用mtk烧录工具flashtool
  • Visio如何对文本打下标、上标,以及插入公式编辑器等问题(已解决)
  • 快速将iPhone大量照片快速传输到电脑的办法!
  • TCP/IP协议簇包含的协议
  • 天地图绘制区域图层
  • git权限不够:Ask a project Owner or Maintainer to create a default branch
  • AI在材料科学中的应用
  • VSCode快速设置heder和main函数
  • JimuReport积木报表 v1.6.2 版本正式发布—开源免费的低代码报表
  • sqlsession对象为什么不能被共享?
  • MySQL MMM高可用架构
  • Spring Boot中配置文件介绍及其使用教程
  • Hobby脚本自动化工具
  • Matlab随机数的产生