archetypes

How can I provide custom logic in a Maven archetype?

送分小仙女□ 提交于 2019-12-20 10:37:07
问题 I'm interested in creating a Maven archetype, and I think I have most of the basics down. However, one thing I'm stuck on is that sometimes I want to use custom logic to fill in a template. For example, if somebody generates my archetype and specifies the artifactId as hello-world, I'd like to generate a class named HelloWorld that simply prints out "Hello World!" to the console. If another person generates it with artifactId = howdy-there, the genned class would be HowdyThere and it would

Maven create archetype: Is there a way to declare properties (defaulted to a value) so as not to have them prompted?

落爺英雄遲暮 提交于 2019-12-12 05:29:51
问题 I am working on creating a maven archetype. It is working fine. I have one more enhancement to do which is explained below In the archetype-metadata.xml , I declared the following properties. <requiredProperties> <requiredProperty key="item1"> <defaultValue>${artifactId}_1</defaultValue> </requiredProperty> <requiredProperty key="item2"> <defaultValue>${artifactId}_2</defaultValue> </requiredProperty> </requiredProperties> When I create the project, it is prompting for the required properties

My Archetypes-based content type can't be viewed

可紊 提交于 2019-12-11 06:09:13
问题 I have a little Plone extension which contains a simple Archetypes-based content type (the same which I had not been able to add TTW, see my previous question); the project setup is on GitHub. After adding an object, I get a KeyError: 'view' during execution of the plone.abovecontenttitle content provider: {'container': <MyType at /plone/test-for-new-types/a-mytype-object>, 'context': <MyType at /plone/test-for-new-types/a-mytype-object>, 'default': <object object at 0x7fc4f8ebe520>, 'here':

Maven Error: No plugin found for prefix ‘archetype’ in the current project using Nexus

只愿长相守 提交于 2019-12-11 03:38:24
问题 I am trying to setup MAVEN in my company's local network which is not connected to the internet directly. Also I'm using sonatype nexus for my central repository. Problem starts when I run the command mvn archetype:create . The result is always build failure. error no plugin found for prefix 'archetype' in the current project. How do I solve this issue? 回答1: Maven is trying to look up the full plugin artifact ID that corresponds the "archetype" prefix. To do this it reads the available

Migrating Archetype news items to Dexterity content types

*爱你&永不变心* 提交于 2019-12-09 18:25:44
问题 I'm trying to copy the content in news items to other content type that I wrote. In my script I have the news item and the project item. The second, project , is a content type defined using Dexterity. It would be wonderful if I could to copy the image and the body text from news to project in the next way. project.text = news.text project.image = news.image Where text and image are defined in the project schema as RichText and NamedBlobImage. I don't know how the attributes are in the news

Build Sling Failure: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:integration-test (default-integration-test)

╄→гoц情女王★ 提交于 2019-12-09 17:21:47
问题 im trying to build sling cause I need it for a project at the university. Can anyone tell me, how I can solve this error? [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 54.112s [INFO] Finished at: Sun Mar 25 18:51:41 CEST 2012 [INFO] Final Memory: 68M/165M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2

Can I add custom objects to Velocity context with Maven archetype plugin?

删除回忆录丶 提交于 2019-12-09 16:33:40
问题 We have a number of code generators that use Velocity to generate projects. The generation can be quite complicated: reflection is used (to introspect 3rd party proxies that we have to interface with) prior to calling velocity - the resulting properties (a complex object graph) are added to the velocity context the project structure and files can vary depending on the options selected the templates do more than just variable substitution (they make use of a custom object added to the velocity

Preventing users to upload BMP, TIFF etc. images to ImageField in Plone

≯℡__Kan透↙ 提交于 2019-12-07 10:15:35
问题 The users do it because they can. However, image auto-resize etc. breaks down. This make me a sad boy. How to limit image uploads to GIF, PNG and JPEG sitewide? For Archetypes For Dexterity 回答1: i ran into similar problems these days and worked around them like that: add a custom widget that adds an accept attribute to the file input set field.swallowResizeExceptions = True so users at least don't get a site-error when uploading an unsopported image type state mimetypes that work in

Migrating from (now obsolete) custom ATImage content type

 ̄綄美尐妖づ 提交于 2019-12-05 11:52:13
We had a whole collection of Plone 3 sites with a custom Image type subclassed from ATImage. This allowed us to add an extra image scaling to the standard list ("'logo':(454, 58)", used by our theme package). While this still works in Plone 4, it isn't really the correct approach now that plone.app.imaging is part of the standard toolkit. That can define custom scales on the fly. It looks like I can enable plone.app.imaging on any type subclassed from ATImage by simply setting "sizes = None" for the collection of custom scales on the type. I am however then left with a redundant subclass of

Preventing users to upload BMP, TIFF etc. images to ImageField in Plone

十年热恋 提交于 2019-12-05 11:48:40
The users do it because they can. However, image auto-resize etc. breaks down. This make me a sad boy. How to limit image uploads to GIF, PNG and JPEG sitewide? For Archetypes For Dexterity i ran into similar problems these days and worked around them like that: add a custom widget that adds an accept attribute to the file input set field.swallowResizeExceptions = True so users at least don't get a site-error when uploading an unsopported image type state mimetypes that work in description The field definition looks like this: atapi.ImageField('image1', swallowResizeExceptions = True, widget =