@warmilk
Учу java как хобби

Как настроить spring boot и maven что бы запускать webpack build script?

Хочу настроить билд ангуляр2 что бы его запускал при старте спринг, у меня есть WebMvcConfig и в нем настройка
private void setLocationForStaticAssets(ConfigurableEmbeddedServletContainer container) {
File root;
String prefixPath = resolvePathPrefix();
root = new File(prefixPath + "target/www/");
if (root.exists() && root.isDirectory()) {
container.setDocumentRoot(root);
}
}
private String resolvePathPrefix() {
String fullExecutablePath = this.getClass().getResource("").getPath();
String rootPath = Paths.get(".").toUri().normalize().getPath();
String extractedPath = fullExecutablePath.replace(rootPath, "");
int extractionEndIndex = extractedPath.indexOf("target/");
if(extractionEndIndex <= 0) {
return "";
}
return extractedPath.substring(0, extractionEndIndex);
}

но если не запускать скрипт npm run webpack:build через терминал то папки конечно же с билдиным ангуляром нет)))
Хочу не запускать это отдельно, а что бы все с одной кнопки билдилось!
Так же в pom я добавил :
plugin>
groupId>com.github.eirslett
artifactId>frontend-maven-plugin
version>${frontend-maven-plugin.version}
executions>

id>install node and npm
goals>
goal>install-node-and-npm
/goals>
configuration>
${node.version}
npmVersion>${npm.version}
/configuration>
/execution>
execution>
id>webpack build dev
goals>
goal>npm
/goals>
generate-resources
configuration>
arguments>run webpack:build
/configuration>
/execution>
/executions>
/plugin>

но он не запускается !!!
  • Вопрос задан
  • 824 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы