I had followed the below link to install B2B & B2C store parallelly
https://wiki.hybris.com/pages/viewpage.action?spaceKey=accdoc&title=Installing+B2C+and+B2B+Accelerators+in+Parallel
After, following the steps, I was able to get OOB electronics and powertools store.
Now, I am going to create my own custom B2C store by using modulegen.
But, I am getting error as:
Trying to override old definition of task lesscss
Trying to override old definition of task movelibs
Trying to override old definition of task generatevariables
modulegen:
[input]
[input] Please choose a template for generation.
[input] Press [Enter] to use the default value (acceleratorordermanagement, [accelerator], chinaaccelerator, commercewebservices, b2baccelerator)
[input]
[input] Please choose the name of your module extension. It has to start with a letter followed by letters and/or numbers.
[input] Press [Enter] to use the default value [training]
merchandise
[input]
[input] Please choose the base package name of your extensions. It has to fulfill java package name convention. Each extension in the module will add its name to this package.
[input] Press [Enter] to use the default value [org.training]
de.hybris.merchandise
[echo] Using extension template source: C:\hybris-commerce-suites-5.7.0.3\hybris\bin\ext-template\yacceleratorcore
[echo] Using extension template source: C:\hybris-commerce-suites-5.7.0.3\hybris\bin\ext-template\yacceleratorfacades
[echo] Using extension template source: C:\hybris-commerce-suites-5.7.0.3\hybris\bin\custom\yb2bacceleratorstorefront
[echo] Using extension template source: C:\hybris-commerce-suites-5.7.0.3\hybris\bin\ext-template\yacceleratortest
[echo] Using extension template source: C:\hybris-commerce-suites-5.7.0.3\hybris\bin\ext-template\yacceleratorstorefront
[echo] Using extension template source: C:\hybris-commerce-suites-5.7.0.3\hybris\bin\ext-template\yacceleratorfulfilmentprocess
[echo] Using extension template source: C:\hybris-commerce-suites-5.7.0.3\hybris\bin\ext-template\yacceleratorinitialdata
[echo] Using extension template source: C:\hybris-commerce-suites-5.7.0.3\hybris\bin\ext-template\yacceleratorcockpits
[echo] Processing extension yacceleratorcore
[mkdir] Created dir: C:\hybris-commerce-suites-5.7.0.3\hybris\temp\hybris\extgen\yacceleratorcore
[echo] Copying template files from C:\hybris-commerce-suites-5.7.0.3\hybris\bin\ext-template\yacceleratorcore to C:\hybris-commerce-suites-5.7.0.3\hybris\temp\hybris/extgen/yacceleratorcore
[copy] Copying 474 files to C:\hybris-commerce-suites-5.7.0.3\hybris\temp\hybris\extgen\yacceleratorcore
[echo] Replacing tokens in template files: C:\hybris-commerce-suites-5.7.0.3\hybris\temp\hybris/extgen
[replace] Replaced 428 occurrences in 100 files.
[copy] Copying 474 files to C:\hybris-commerce-suites-5.7.0.3\hybris\temp\hybris\extgen_final\yacceleratorcore
[echo] Processing extension yacceleratorfacades
[mkdir] Created dir: C:\hybris-commerce-suites-5.7.0.3\hybris\temp\hybris\extgen\yacceleratorfacades
[echo] Copying template files from C:\hybris-commerce-suites-5.7.0.3\hybris\bin\ext-template\yacceleratorfacades to C:\hybris-commerce-suites-5.7.0.3\hybris\temp\hybris/extgen/yacceleratorfacades
[copy] Copying 70 files to C:\hybris-commerce-suites-5.7.0.3\hybris\temp\hybris\extgen\yacceleratorfacades
[echo] Replacing tokens in template files: C:\hybris-commerce-suites-5.7.0.3\hybris\temp\hybris/extgen
[replace] Replaced 117 occurrences in 40 files.
[copy] Copying 70 files to C:\hybris-commerce-suites-5.7.0.3\hybris\temp\hybris\extgen_final\yacceleratorfacades
[echo] Processing extension yb2bacceleratorstorefront
BUILD FAILED
C:\hybris-commerce-suites-5.7.0.3\hybris\bin\platform\build.xml:121: The following error occurred while executing this line:
C:\hybris-commerce-suites-5.7.0.3\hybris\bin\platform\resources\ant\modulegen.xml:324: The following error occurred while executing this line:
C:\hybris-commerce-suites-5.7.0.3\hybris\bin\platform\resources\ant\modulegen.xml:330: The following error occurred while executing this line:
C:\hybris-commerce-suites-5.7.0.3\hybris\bin\platform\resources\ant\modulegen.xml:45: extgen.properties in source extension not found! this is not a template!
Total time: 22 seconds
C:\hybris-commerce-suites-5.7.0.3\hybris\bin\platform>
localextension.xml:
<extension name='mcc' />
<extension name='backoffice' />
<extension name='commercesearchbackoffice' />
<extension name='commerceservicesbackoffice' />
<extension name='solrfacetsearchbackoffice' />
<extension name='yacceleratorcockpits' />
<extension name='yacceleratorinitialdata' />
<extension name='yacceleratorfulfilmentprocess' />
<extension name='yacceleratorstorefront' />
<extension name='yaddon' />
<extension name='ycommercewebservices' />
<extension name="electronicsstore"/>
<extension name="apparelstore"/>
<extension name='solrserver' />
<extension name='liveeditaddon' />
<extension name='acceleratorwebservicesaddon' />
<extension name='powertoolsstore' />
<extension name='b2bcommercebackoffice' />
<extension name='b2badmincockpit' />
<extension name='b2bacceleratoraddon' />
<extension name='commerceorgaddon' />
<extension dir="C:\hybris-commerce-suites-5.7.0.3\hybris\bin/custom/yb2bacceleratorstorefront"/>
Its because you have that new, custom, yb2bacceleratorstorefront extension in your custom folder, and this is autoloading due to the line above your snippet of localextensions.xml.
This extension is then trying to get involved in the modulegen as it contains the same modulegen key due to you just generating from it, but is no longer a template as you generated it.
You should be doing the modulegen first. Then, generate as many additional storefronts as you like. But bear in mind these are just tools to help you out, and if you want to do more complex things you'll have to figure out how.
With above solutions you also cheek this.
You have one custom extension- yb2bacceleratorstorefront. Kindly check its extensioninfo.xml, You may find below line
meta key="modulegen-name" value="accelerator,b2baccelerator,chinaaccelerator"
Commenting this line solved the problem for me.
I've not tested this, but I suspect that this is a path issue.
<extension dir="C:\hybris-commerce-suites-5.7.0.3\hybris\bin/custom/yb2bacceleratorstorefront"/>
Does it exist? Try loading the extension by name - e.g.
<extension name="yb2bacceleratorstorefront"/>
If this works, then it points at an issue with loading the extension based on the directory (most likely an incorrect path).
Related
I have recently upgraded my asp.net core project to .net core 2.2 and at same time updated NLog.Web.AspNetCore.
After I did this (maybe coincidence?) I noticed that log files are not being generated.
In my config this is my target:
<target xsi:type="File" name="allfile" fileName="${currentdir}/Logs/nlog-all-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}" />
After some debugging I realised that if I specified the path explicitly then it would generate log file:
<target xsi:type="File" name="allfile" fileName="E:\Project\Logs\nlog-all-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}" />
I have throwExceptions="true" set in config but when a file is not generated no exception is thrown, it just silently doesn't create the file.
To further debug this I created a console project and added nuget NLog.Web.AspNetCore and copied my config. Now in the console project it works fine and is creating log files in the debug output directory.
Is there any way to debug why the log file isn't being generated with this target in my main project?
Instead of using ${currentdir} then consider using ${aspnet-appbasepath} (Or ${basedir} if not in-process-hosting)
NLog InternalLogger usually gives very good hints when something is not working as expected.
Please avoid using throwExceptions="true" as it is for unit-testing, and not for production environments.
I have a question based from this question
Replacing characters in Ant property
I want to build a variable (i can't use a property because i'm in a loop) that is pretty much StringA - StringB.
(maybe this is a misunderstanding of properties on my part but they can only be assigned once correct?)
I guess I could build a script function to calculate that, but my guess is that it must be possible to do it in an already existing function, probably something i'm missing.
this would be an example of the code
<for param="file">
<path>
<fileset dir="${mydir}" >
<include name="*.war"/>
</fileset>
</path>
<sequential>
<var name="undeploy_name" value="#{file} function_here ${mydir}" />
<JBossCLI port="${jboss.port.management-native}">
<undeploy namePattern="${undeploy_name}" />
</JBossCLI>
<deployToLiferay file="#{file}" />
</sequential>
</for>
in general I want to deploy several wars. this works fine when I run it once but if I want to make it re-runnable I need to undeploy them first.
I'm just a consumer of this interfaces, Ideally deployToLiferay would auto undeploy but it does not.
thanks for an feedback
edit: if I use something similar to what is define on the linked page i get:
<loadresource property="file-to-deploy">
<propertyresource name="#{file}"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replacestring from="${mydir}" to=""/>
</tokenfilter>
</filterchain>
</loadresource>
10:52:49.541: * /data/contribution.xml:171: The following error occurred while executing this line:
10:52:49.541: * /data/contribution.xml:178: null doesn't exist
line 178 is my loadresource part
ANT is not a programming language. Personally I'd recommend embedding a scripting language like Groovy to process a group of files:
<target name="process-files" depends="resolve">
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="build.path"/>
<fileset id="wars" dir="src/wars" includes="*.war"/>
<groovy>
project.references.wars.each {
ant.echo(message: "I want to do something with this ${it} file")
}
</groovy>
</target>
Example
├── build.xml
└── src
└── wars
├── app1.war
├── app2.war
└── app3.war
Example
process-files:
[echo] I want to do something with this /../src/wars/app1.war file
[echo] I want to do something with this /../src/wars/app2.war file
[echo] I want to do something with this /../src/wars/app3.war file
Update
The following working example shows how Apache ivy can be used to manage build dependencies. This is a capability that exists in other Java build tools like Maven.
<project name="demo" default="process-files" xmlns:ivy="antlib:org.apache.ivy.ant">
<available classname="org.apache.ivy.Main" property="ivy.installed"/>
<!--
==================
Normal ANT targets
==================
-->
<target name="process-files" depends="resolve">
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="build.path"/>
<fileset id="wars" dir="src/wars" includes="*.war"/>
<groovy>
project.references.wars.each {
ant.echo(message: "I want to do something with this ${it} file")
}
</groovy>
</target>
<!--
=============================
Dependency management targets
=============================
-->
<target name="resolve" depends="install-ivy">
<ivy:cachepath pathid="build.path">
<dependency org="org.codehaus.groovy" name="groovy-all" rev="2.4.7" conf="default"/>
</ivy:cachepath>
</target>
<target name="install-ivy" unless="ivy.installed">
<mkdir dir="${user.home}/.ant/lib"/>
<get dest="${user.home}/.ant/lib/ivy.jar" src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.4.0/ivy-2.4.0.jar"/>
<fail message="Ivy has been installed. Run the build again"/>
</target>
</project>
I am new to Hybris. I am able to configure Hybris Administration Console and access the sections by following wiki.hybris documents.
I dont find a section to configure the Hybris Management Console (HMC). I get 404 error when I access the URL http://localhost:9001/hmc. Please let me know where to find to get this URL working.
UPDATE
I am sorry for not giving enough information in my original post.
I am using Hybris Commerce Suite 5.7.0.8 and followed the steps mentioned in wiki.hybris.
I executed the following commands in CMD.
setantenv.bat
ant clean all
hybrisserver.bat
Then logged into http://localhost:9001/ using admin credentials
Under Platform--> Initialization, I initialized to recreate the new
tables.
Apart from the above, I did not do any other steps. I noticed that the extensions under HMC in Platform-->Extension, are all marked as X. Please refer to the attached image.
You are missing the hmc as part of your localextensions.xml file... see the answer at: https://stackoverflow.com/a/33110971/932201
After adding the hmc extension you have to run an update running system from the hac (or re-initialize).
Note though that the hmc is the old backoffice application, in more recent versions it had first been depracted and finally been removed.
The new backoffice application is called backoffice and its url is by default:
http://localhost:9001/backoffice
(you would also have to add the backoffice extension to your localextensions.xml file to make it available)
Good luck!
Perform the following steps :
Step 1 : Add the following main modules in localextensions.xml
<extension name="admincockpit" />
<extension name="backoffice" />
<extension name="cockpit" />
<extension name="hmc" />
<extension name="mcc" />
<extension name="platformhmc" />
Step 2: Run ant clean all
Step 3 : Run update from HAC
The hMC is usually available on http://localhost:9001/hmc (or /hmc/hybris if you don't want it opening in a pop up).
I'd suggest checking your server logs (~YOUR_HYBRIS_DIR/hybris/log/tomcat/console.log) and seeing if there's any errors in it.
Make sure you have not altered the property hmc.webroot. It should be set to /hmc by default, but you can try explicitly setting it in your local.properties file like this:
hac.webroot=/hac
hmc.webroot=/hmc
Also you need to initialize the system before you can access anything other than the HAC.
You can do this either using your browser via the HAC or using ant:
ant clean all initialize
You can read all about Hybris' initialize and update processes here:
https://wiki.hybris.com/display/release5/Initializing+and+Updating+the+hybris+Commerce+Suite
Hope this helps
In recent versions of Hybris they have introduced an installer script that sets up the basics for you. What this means though is that if you just go right ahead and simply run ant all, you will get a localextensions.xml file with almost everything disabled.
What you should do is install hybris using the installer script and one of the recipies. See here:
https://wiki.hybris.com/display/release5/Sample+Scenarios+Installation
This will generate you a decent starting configuration for what ever you want to do with hybris.
For example, when I install the recipe b2c_acc (B2C Accelerator), I get the following localextensions.xml file generated:
<hybrisconfig xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='../bin/platform/resources/schemas/extensions.xsd'>
<extensions>
<path dir='${HYBRIS_BIN_DIR}' autoload='false' />
<extension name='mcc' />
<extension name='backoffice' />
<extension name='commercesearchbackoffice' />
<extension name='commerceservicesbackoffice' />
<extension name='solrfacetsearchbackoffice' />
<extension name='solrserver' />
<extension name='yacceleratorcockpits' />
<extension name='yacceleratorinitialdata' />
<extension name='yacceleratorfulfilmentprocess' />
<extension name='yacceleratorstorefront' />
<extension name='yaddon' />
<extension name='ycommercewebservices' />
<extension name='electronicsstore' />
<extension name='apparelstore' />
<extension name='liveeditaddon' />
<extension name='acceleratorwebservicesaddon' />
</extensions>
</hybrisconfig>
Once you have done this, I also strongly recommend installing MySQL and using that as your database rather than the default HSQLDB approach as it is much, much faster. See here:
https://wiki.hybris.com/display/release5/MySQL
Hope this helps
Go to http://localhost:9001/mcc (log as an admin) you will find all links of your current Hybris installation.
What version of Hybris are you using ? Do you see the hmc extension when you go to the HAC ?
Edit:
With 5.7 the default localextensions.xml is mostly empty by default, you will need to run an installer like '. install.sh -r b2c_acc_plus' from your installer directory (first level of your Hybris installation)
Im using Azure SDK 2.5
I have a web role in a cloud service project. I would like to add a folder in some fashion such that it is deployed in the parent directory of the approot. I havent found a way to do this which kind of makes me wonder what use is the ability to define virtual directories in csdef.
So I thought I would try adding folders via the Contents/Content xml config in the csdef. I am either fundamentally misunderstanding what this bit of config does or its hopelessly broken.
Assuming this folder structure
/
/CloudService
/SomeOtherContent
If I define the following:
<Contents>
<Content destination="frontend">
<SourceDirectory path="..\SomeOtherContent" />
</Content>
</Contents>
and build I get:
error CloudServices089: Cannot find the source directory
'C:\src\template\src\Template.CloudService\bin\Debug\..\SomeOtherContent'
Ok so its starting the bin\Debug, so I'll just make it ..\..\..\SomeOtherContent
error CloudServices089: Cannot find the source directory
'C:\src\template\src\Template.CloudService\..\..\..\SomeOtherContent'
Yes thats right, the folder at which my relative path is resolved has changed!!! Its no longer bin\Debug. Wtf!? How can this be made to work? It works if i enter a full drive qualified absolute path.
So I solved this by having MSBuild resolve the path and push it in to an environment variable which I called FrontendDir.
<Contents>
<Content destination="frontend">
<SourceDirectory path="%FrontendDir%" />
</Content>
</Contents>
and in the ccproj I added:
<UsingTask
TaskName="SetEnvironmentVariableTask"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll">
<ParameterGroup>
<Name ParameterType="System.String" Required="true" />
<Value ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
Environment.SetEnvironmentVariable(Name, Value);
]]>
</Code>
</Task>
</UsingTask>
<Target Name="BeforeBuild" Condition=" '$(FrontendDir)' == '' ">
<Message Text="Setting Project Dir" Importance="high" />
<SetEnvironmentVariableTask Name="FrontendDir" Value="$(ProjectDir)\..\Template.FrontEnd\dist" />
</Target>
Its preferable to put the entire path into the env var here as you can then override it easily in your different build scenarios by overriding the value (eg. /p:FrontendDir="c:\foo")
So that works and works fairly well. I still say the behaviour I was seeing before with the relative path resolution changing folders is... broken. It just doesn't work with relative paths in any usable way.
You are seeing the same error but from different msbuild targets.
The first error (when using ..\..\) is thrown at PreValidateServiceModel which passes in the Source location and checks the path
ServiceDefinitionFile="#(SourceServiceDefinition)"
ServiceConfigurationFile="#(SourceServiceConfiguration)"
C:\src\Azure\ServiceDefinition.csdef : error CloudServices089: Cannot
find the source directory 'C:\src\Azure\..\..\Installers\' in role
WebHost. [C:\src\Azure\Azure.ccproj]
Done building target "PreValidateServiceModel" in project "Azure.ccproj" -- FAILED.
The second error is thrown at ValidateServiceFiles which passes in the Target location
ServiceDefinitionFile="#(TargetServiceDefinition)"
ServiceConfigurationFile="#(TargetServiceConfiguration)">
C:\src\Azure\bin\Release\ServiceDefinition.csdef : error CloudServices089: Cannot
find the source directory
'C:\src\Azure\bin\Release\Installers\'
in role WebHost. [C:\src\Azure\Azure.ccproj]
Done building target "ValidateServiceFiles" in project "Azure.ccproj" -- FAILED.
If you reflect on C:\Program Files\Microsoft SDKs\Azure.NET SDK\v2.9\bin\ServiceDescription.dll you can see the ProcessRoleContents method doing the validation but using the SourceFile to resolve the location.
One option is to make sure the target folder exists (even if empty) before the build starts.
It would be better if the PreValidation resolved the path and when the Target is saved, it had the full path.
I ended up editing the ccproj, and adding this
<Target Name="BeforeAddRoleContent">
<ItemGroup>
<AzureRoleContent Include="Installers\">
<RoleName>Azure</RoleName>
<Destination></Destination>
</AzureRoleContent>
</ItemGroup>
</Target>
Referencing runtime content from .ccproj (Azure SDK 2.9)
I have a file called versionInfo.txt. This file among other things has the following text: "Implementation-Version: 7.5.0.1".
I need to retrieve the version value and copy this version value to a Java file. The Java file will have the following variable:
version = "#version-info#";
I need to replace this #version-info# with the value I retrieved from the first file. I need to do plug in this code in an existing build.xml file written using ant script.
Create a properties file like this and name it build.properties
version.label=7.5.0.1
Then in your build.xml file
<project basedir=".">
<target name="replace-labels">
<property file="${basedir}/build.properties"/>
<replace
file="${basedir}/myClass.java"
token="#version-info#"
value="${version.label}" />
</target>
</project>
So your file structure should look like
myproject
build.properties
build.xml
myClass.java
Then you can execute your ANT build by changing to the "myproject" directory and executing
ant replace-labels
The replace tag will look for the string "#version-info#" in your myClass.java file and replace it with the value "7.5.0.1"
For the second part of your question, retrieve the version info.. :
If you need to read the Implementation-Version from the Manifest of a jar you may use a macrodef, f.e. :
<!-- Grep a keyvalue from Manifest -->
<macrodef name="mfgrep">
<attribute name="jar"/>
<attribute name="key"/>
<attribute name="catch"/>
<sequential>
<loadproperties>
<zipentry zipfile="#{jar}" name="META-INF/MANIFEST.MF"/>
</loadproperties>
<property name="#{catch}" value="${#{key}}"/>
</sequential>
</macrodef>
<mfgrep
jar="/home/rosebud/temp/ant.jar"
key="Implementation-Version"
catch="foobar"
/>
<echo>$${foobar} => ${foobar}</echo>