我有以下应用程序文件夹结构。
-- Web App
---- node_modules
---- src (source files)
---- angular-cli.json
---- package.json
-- node_modules
-- ServiceApp1
---- src (source files)
-- ServiceApp2
---- src (source files)
-- package.json
服务应用程序共享依赖关系,这些依赖关系位于根级别package.json中。这是webpack模块构建的默认行为。如果它在当前文件夹中没有看到node_modules文件夹,它将查找父文件夹。这很好用,因为我有这些共享依赖项,只有一个node_modules文件夹用于服务应用程序。我希望所有应用程序共享相同的package.json和node_modules。
然而,网络应用程序使用angular-cli。如果我从它的本地package.json中删除所有依赖项,我会收到以下错误:
You have to be inside an Angular CLI project in order to use the serve command.
如果我将angular-cli.json移动到root并将“apps”:“root”从“src”更改为“web \ src”,我会收到以下错误:
> ng serve --base-href=web
** NG Live Development Server is running on http://localhost:4200. **
49% building modules 549/837 modules 288 active ...ngular/material/core/portal/portal.jsError: No module factory available for dependency type: ContextElementDependency
at Compilation.addModuleDependencies (/Users/dev/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:206:21)
at Compilation.processModuleDependencies (/Users/dev/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:195:8)
at _this.buildModule.err (/Users/dev/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:335:13)
at building.forEach.cb (/Users/dev/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:140:27)
at Array.forEach (native)
at callback (/Users/dev/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:140:13)
at module.build (/Users/dev/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:167:11)
at ContextModule.<anonymous> (/Users/dev/node_modules/@angular/cli/node_modules/webpack/lib/ContextModule.js:118:3)
at ContextModule.result.resolveDependencies (/Users/dev/node_modules/@ngtools/webpack/src/plugin.js:197:25)
at ContextModule.build (/Users/dev/node_modules/@angular/cli/node_modules/webpack/lib/ContextModule.js:99:7)
at Compilation.buildModule (/Users/dev/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:142:10)
at factoryCallback (/Users/dev/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:324:11)
at /Users/dev/node_modules/@angular/cli/node_modules/webpack/lib/ContextModuleFactory.js:96:12
at /Users/dev/node_modules/tapable/lib/Tapable.js:204:11
at done.then (/Users/dev/node_modules/@ngtools/webpack/src/plugin.js:199:28)
at process._tickCallback (internal/process/next_tick.js:103:7)
49% building modules 550/837 modules 287 active ...ngular/material/core/portal/portal.js/Users/dev/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:329
if(_this.profile) {
TypeError: Cannot read property 'profile' of null
构建子文件夹中存在的angular-cli项目的最佳方法是什么?我知道angular-cli不支持构建多个项目,没关系,我只有1个web / cli项目。
答案 0 :(得分:0)
private String userName;
private String userPassword;
private String mensaje ="";
public void validar(String usuario, String password) {
try {
//Este metodo funciona para validar el usuario,
//si el usuario tiene nombre y pass correcto devuelve un OK
//Si el usuario da error entonces cierra la conexion
//Generamos el DN
final String dn = "uid=" + usuario +",ou=users,cn=admin,dc=organizacion,dc=com,dc=uy";
//Solicitamos el bindRequest creando una nueva instancia y de parametros el dn y pass
final BindRequest bindRequest = new SimpleBindRequest(dn, password);
//Nos conectamos al server
final LDAPConnection ldapConnection = new LDAPConnection("192.168.1.1", 389);
//Intentamos hacer el bind
final BindResult bindResult = ldapConnection.bind(bindRequest);
//Obtenemos el resultcode de la funcion anterior (SUCCESS o FAIL)
final ResultCode resultCode = bindResult.getResultCode();
//Si el resultado es SUCESS entonces metemos el codigo aca
// podemos iniciar una sesion, pasar valores a un session bean, etc
if (resultCode.equals(ResultCode.SUCCESS)) {
this.mensaje = "Validacion correcta";
} else {
//Damos un error y cerramos la conexion
this.mensaje = "Validacion incorrecta";
ldapConnection.close();
}
} catch (Exception e) {
this.mensaje = "Mensaje de error";
}