Uploaded image for project: 'Syncope'
  1. Syncope
  2. SYNCOPE-1260

"conf.directory" management in Archetype output

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.0.7
    • None
    • archetype
    • None

    Description

      The default build based on the archetype will create WAR files whose configuration is hardcoded to the test configurations instead of the main ones.

      ie. src/test/resrources/... will be used instead of src/main/resources/...

      Here's the what I did:

      Creation of the project from the archetype:

      ubuntu@syncope-01:~$ mvn archetype:generate -DarchetypeGroupId=org.apache.syncope -DarchetypeArtifactId=syncope-archetype -DarchetypeRepository=http://repo1.maven.org/maven2 -DarchetypeVersion=2.0.7
      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building Maven Stub Project (No POM) 1
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] >>> maven-archetype-plugin:3.0.1:generate (default-cli) > generate-sources @ standalone-pom >>>
      [INFO]
      [INFO] <<< maven-archetype-plugin:3.0.1:generate (default-cli) < generate-sources @ standalone-pom <<<
      [INFO]
      [INFO]
      [INFO] — maven-archetype-plugin:3.0.1:generate (default-cli) @ standalone-pom —
      [INFO] Generating project in Interactive mode
      [INFO] Archetype repository not defined. Using the one from [org.apache.syncope:syncope-archetype:2.0.7] found in catalog remote
      Define value for property 'groupId': lu.luxairgroup.iam
      Define value for property 'artifactId': syncope-iam
      Define value for property 'version' 1.0-SNAPSHOT: :
      Define value for property 'package' lu.luxairgroup.iam: :
      [INFO] Using property: adminPassword = 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
      Define value for property 'anonymousKey': toto
      Define value for property 'jwsKey': toto
      Define value for property 'secretKey': toto
      Confirm properties configuration:
      groupId: lu.luxairgroup.iam
      artifactId: syncope-iam
      version: 1.0-SNAPSHOT
      package: lu.luxairgroup.iam
      adminPassword: 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
      anonymousKey: toto
      jwsKey: toto
      secretKey: toto
      Y: :
      [INFO] ----------------------------------------------------------------------------
      [INFO] Using following parameters for creating project from Archetype: syncope-archetype:2.0.7
      [INFO] ----------------------------------------------------------------------------
      [INFO] Parameter: groupId, Value: lu.luxairgroup.iam
      [INFO] Parameter: artifactId, Value: syncope-iam
      [INFO] Parameter: version, Value: 1.0-SNAPSHOT
      [INFO] Parameter: package, Value: lu.luxairgroup.iam
      [INFO] Parameter: packageInPathFormat, Value: lu/luxairgroup/iam
      [INFO] Parameter: adminPassword, Value: 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
      [INFO] Parameter: secretKey, Value: toto
      [INFO] Parameter: jwsKey, Value: toto
      [INFO] Parameter: package, Value: lu.luxairgroup.iam
      [INFO] Parameter: version, Value: 1.0-SNAPSHOT
      [INFO] Parameter: anonymousKey, Value: toto
      [INFO] Parameter: groupId, Value: lu.luxairgroup.iam
      [INFO] Parameter: artifactId, Value: syncope-iam
      [INFO] Parent element not overwritten in /home/ubuntu/syncope-iam/syncope-iam/common/pom.xml
      [INFO] Parent element not overwritten in /home/ubuntu/syncope-iam/syncope-iam/core/pom.xml
      [INFO] Parent element not overwritten in /home/ubuntu/syncope-iam/syncope-iam/console/pom.xml
      [INFO] Parent element not overwritten in /home/ubuntu/syncope-iam/syncope-iam/enduser/pom.xml
      [INFO] Project created from Archetype in dir: /home/ubuntu/syncope-iam/syncope-iam
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 53.105 s
      [INFO] Finished at: 2018-01-03T13:59:20Z
      [INFO] Final Memory: 17M/186M
      [INFO] ------------------------------------------------------------------------

      Then build the project:

      ubuntu@syncope-01:~/syncope-iam$ mvn -Pall clean install
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Build Order:
      [INFO]
      [INFO] Apache Syncope sample project
      [INFO] Apache Syncope sample project - Common
      [INFO] Apache Syncope sample project - Core
      [INFO] Apache Syncope sample project - Console
      [INFO] Apache Syncope sample project - Enduser
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building Apache Syncope sample project 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] — maven-clean-plugin:3.0.0:clean (default-clean) @ syncope-iam —
      [INFO]
      [INFO] — maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ syncope-iam —
      [INFO]
      [INFO] — gmaven-plugin:1.5:execute (default) @ syncope-iam —
      [INFO]
      [INFO] — maven-remote-resources-plugin:1.5:process (process-resource-bundles) @ syncope-iam —
      [INFO]
      [INFO] — maven-resources-plugin:3.0.2:copy-resources (copy-artifact-legal-files) @ syncope-iam —
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO]
      [INFO] — maven-resources-plugin:3.0.2:copy-resources (copy-javadoc-legal-files) @ syncope-iam —
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      ....

      Then checked the content of the core Spring context:

      ubuntu@syncope-01:~/syncope-iam$ cat core/target/classes/coreContext.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <!--
      Licensed to the Apache Software Foundation (ASF) under one
      or more contributor license agreements. See the NOTICE file
      distributed with this work for additional information
      regarding copyright ownership. The ASF licenses this file
      to you under the Apache License, Version 2.0 (the
      "License"); you may not use this file except in compliance
      with the License. You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing,
      software distributed under the License is distributed on an
      "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
      KIND, either express or implied. See the License for the
      specific language governing permissions and limitations
      under the License.
      -->
      <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans.xsd">

      <bean id="confDirectoryPropertyConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
      <property name="order" value="1"/>
      <property name="ignoreResourceNotFound" value="true"/>
      <property name="ignoreUnresolvablePlaceholders" value="true"/>
      <property name="locations">
      <list>
      <value>file:/home/ubuntu/syncope-iam/core/target/test-classes/persistence.properties</value>
      <value>file:/home/ubuntu/syncope-iam/core/target/test-classes/domains/*.properties</value>
      <value>file:/home/ubuntu/syncope-iam/core/target/test-classes/security.properties</value>
      <value>file:/home/ubuntu/syncope-iam/core/target/test-classes/connid.properties</value>
      <value>file:/home/ubuntu/syncope-iam/core/target/test-classes/mail.properties</value>
      <value>file:/home/ubuntu/syncope-iam/core/target/test-classes/logic.properties</value>
      <value>file:/home/ubuntu/syncope-iam/core/target/test-classes/workflow.properties</value>
      <value>file:/home/ubuntu/syncope-iam/core/target/test-classes/provisioning.properties</value>
      </list>
      </property>
      </bean>
      <bean id="classpathPropertyConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
      <property name="locations">
      <list>
      <value>classpath:persistence.properties</value>
      <value>classpath:domains/*.properties</value>
      <value>classpath:security.properties</value>
      <value>classpath:connid.properties</value>
      <value>classpath:mail.properties</value>
      <value>classpath:logic.properties</value>
      <value>classpath:workflow.properties</value>
      <value>classpath:provisioning.properties</value>
      </list>
      </property>
      </bean>

      <bean class="org.apache.syncope.core.spring.ApplicationContextProvider"/>

      </beans>

      As you can see, there are some file references to the "test-classes" target folder that makes the execution load them instead of the expected.

      I can work around this issue by adding explicit property to the pom of all projects for "conf.directory" that point to the project build dir's classes folder.

      Is this conf.directory supposed to be filtered by the maven resource plugin or should it be evaluated at runtime by Spring ???
      Am I missing something ?

      At least the default behaviour of the archetype output WAR files can't be used as-is on a local tomcat without a fix.

      Thanks !

      Attachments

        Activity

          People

            Unassigned Unassigned
            alcibiadefr Yannick Kirschhoffer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: