Мне нужно настроить переменную Jenkins в качестве моей базы данных паролей в профиль моего pom, но если я установил ${env.passwordb}
(как показано ниже), проект не компилируется и не получает некоторые ошибки, но если я подтолкнул код к Дженкинсу, он примет переменную и отлично выполнит проект. Что мне нужно изменить?Как установить переменную в качестве пароля базы данных в pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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.company.vrs</groupId>
<artifactId>company-vrs</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>${env.urlTomcat}</url>
<path>${env.appPath}</path>
<username>${env.username}</username>
<password>${env.password}</password>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<packaging>war</packaging>
<name>company-vrs</name>
<url>http://maven.apache.org</url>
<profiles>
<profile>
<id>dev</id>
<build>
<finalName>visitors</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.jks</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.jks</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<mainClass>com.company.vrs.config.AppConfig</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.0.RC0</version>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>asta que
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>9090</port>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<db.url>jdbc:postgresql://hsvvrsdev.company.com:5432/vrs_dev</db.url>
<db.username>vrsuser</db.username>
<db.password>${env.passworddb}</db.password>
<isdev>true</isdev>
<realm.metadata.file>/metadata/secureAuth_dev.xml</realm.metadata.file>
<realm.metadata.url>https://ssodev.company.com/SecureAuth68/metadata.xml</realm.metadata.url>
<realm.url.restart>https://ssodev.company.com/SecureAuth68/restart.aspx</realm.url.restart>
</properties>
</profile>
<profile>
<id>sqa</id>
<build>
<finalName>visitors_sqa</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.jks</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.jks</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<mainClass>com.company.vrs.config.AppConfig</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.0.v20140526</version>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>9090</port>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<db.url>jdbc:postgresql://hsvvrsdev.company.com:5432/vrs_sqa</db.url>
<db.username>vrsuser</db.username>
<db.password>vrs#2015!</db.password>
<istest>true</istest>
<realm.metadata.file>/metadata/secureAuth_dev.xml</realm.metadata.file>
<realm.metadata.url>https://ssodev.company.com/SecureAuth68/metadata.xml</realm.metadata.url>
<realm.url.restart>https://ssodev.company.com/SecureAuth68/restart.aspx</realm.url.restart>
</properties>
</profile>
<profile>
<id>pro</id>
<build>
<finalName>visitors</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.jks</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.jks</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<mainClass>com.company.vrs.config.AppConfig</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.0.v20140526</version>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>9090</port>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<db.url>jdbc:postgresql://hsvvrsdb.company.com:5432/vrs</db.url>
<db.username>vrsuser</db.username>
<db.password>v14r3s20150302</db.password>
<ispro>true</ispro>
<realm.metadata.file>/metadata/secureAuth_prod.xml</realm.metadata.file>
<realm.metadata.url>https://sso.company.com/visitors/metadata.xml</realm.metadata.url>
<realm.url.restart>https://sso.company.com/visitors/restart.aspx</realm.url.restart>
</properties>
</profile>
</profiles>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-version>4.1.2.RELEASE</spring-version>
<spring-data-jpa-version>1.6.1.RELEASE</spring-data-jpa-version>
<spring-data-commons-version>1.8.1.RELEASE</spring-data-commons-version>
<hibernate-version>4.3.5.Final</hibernate-version>
<org-slf4j-version>1.7.7</org-slf4j-version>
<spring-ldap-version>2.0.1.RELEASE</spring-ldap-version>
<spring-security-version>3.2.3.RELEASE</spring-security-version>
<bonecp-version>0.8.0.RELEASE</bonecp-version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
..... many dependencies ....
</dependencies>
</project>
Ошибка:
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'env.passworddb' in string value "${env.passworddb}"
Я не вижу env.passwordb переменную в этом ПОМ .. мне не хватает smoething? –
@MaciejKowalski извините, у меня было другое имя. Теперь я меняю на $ {env.passworddb} db.password>. –
как выполнить локальную сборку? –