I'm using Eclipse Mars, and I have a Maven application using build-helper-maven-plugin, that is not covered by m2e by default, so I need to add a connector. The point is, I can add the connector when importing the maven project:
However, I have no idea how I would do this manually, when the project is already in the workspace. The pom have an error, Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.10:add-source, but I can't find the option install m2e connector or something like that.
The P2 Update site is here:
https://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-buildhelper/0.15.0/N/0.15.0.201207090124/
This answer helped me to discover how Eclipse knows it.
There is a Catalog that can be opened from the preferences:
You can follow the link manually: http://download.eclipse.org/technology/m2e/discovery/directory-1.8.xml
If you download the org.eclipse.m2e.discovery.oss-catalog-1.6.jar referenced as entry and you unzip it, the you will find a plugin.xml file:
org.eclipse.m2e.discovery.oss-catalog-1.6
├── META-INF
│ └── MANIFEST.MF
├── images
│ ├── extras-48.png
│ └── scm-32.png
├── lifecycle
│ ├── com.coderplus.m2e.jaxws.feature.group.pluginxml
│ ├── com.coderplus.m2e.jaxws.feature.group.xml
│ ├── ..
│ ├── org.eclipse.m2e.discovery.lifecycles.tycho.pluginxml
│ ├── org.eclipse.m2e.discovery.lifecycles.tycho.xml
│ ├── org.maven.ide.eclipse.ajdt.pluginxml
│ └── org.maven.ide.eclipse.ajdt.xml
└── plugin.xml
And this file contains the information with the P2 Update site:
<connectorDescriptor siteUrl="http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-buildhelper/0.15.0/N/0.15.0.201207090124/" id="org.eclipse.m2e.discovery.lifecyclemapping.buildhelper" groupId="lifecycles" description="buildhelper" categoryId="org.eclipse.m2e.discovery.category.lifecycles" name="buildhelper" provider="Takari, Inc." license="EPL" kind="lifecycles">
<iu id="org.sonatype.m2e.buildhelper.feature.feature.group" />
<overview summary="buildhelper" />
</connectorDescriptor>
Related
I'm using the recommended GWT Maven Plugin and the GWT Eclipse Plugin. Actually I'm using the maven plugin with the appengine-mave-plugin to try to emulate the old Google Eclipse Plugin Super Dev Mode. Following the Google App Engine instructions from the GWT Plugin documentation and the suggested sample project gwt-basic-rpc-appengine I created this project structured that my project runs in super dev mode when I launch the App Engine local server from Eclipse (using the Eclipse Google Cloud Tools local App Engine server launcher tool). From Maven, this process works following: mvn clean package appengine:devserver_start and mvn gwt:codeserver.
However, the Maven GWT plugin only compiles one of the four modules. This is my pom.xml configuration:
<!-- GWT Maven Plugin-->
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.0-rc-8</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<!-- <goal>test</goal>-->
</goals>
</execution>
</executions>
<configuration>
<moduleName>com.company.Administracion</moduleName>
<moduleName>com.company.Cronometro</moduleName>
<moduleName>com.company.Extension</moduleName>
<moduleName>com.company.Company</moduleName>
<!-- <moduleShortName>Nubbius</moduleShortName> -->
<failOnError>true</failOnError>
<!-- GWT compiler 2.8 requires 1.8, hence define sourceLevel here if you use
a different source language for java compilation -->
<sourceLevel>1.8</sourceLevel>
<!-- Compiler configuration -->
<localWorkers>4</localWorkers>
<draftCompile>true</draftCompile>
<compilerArgs>
<!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
<arg>-compileReport</arg>
<arg>-XcompilerMetrics</arg>
</compilerArgs>
<!-- DevMode configuration -->
<!-- <warDir>${project.build.directory}/${project.build.finalName}</warDir>
-->
<launcherDir>${project.build.directory}/${project.build.finalName}</launcherDir>
<classpathScope>compile+runtime</classpathScope>
<codeServerPort>auto</codeServerPort>
<!-- URL(s) that should be opened by DevMode (gwt:devmode). -->
<startupUrls>
<startupUrl>Company.jsp</startupUrl>
</startupUrls>
<jvmArgs>
<arg>-Xms1024M</arg>
<arg>-Xmx2014M</arg>
<!-- <arg>-javaagent:/home/.m2/repository/.../appengine-java-sdk-1.9.59/lib/agent/appengine-agent.jar </arg>--> <arg>-javaagent:/home/desarrollo26/Descargas/appengine-java-sdk-1.9.59/lib/agent/appengine-agent.jar </arg>
</jvmArgs>
</configuration>
</plugin>
The src folder contains the structure:
src/
├── main
│ ├── appengine
│ ├── java
│ │ └── com
│ │ └── company
│ │ ├── client
│ │ ├── server
│ │ └── shared
| |
│ ├── resources
│ │ └── META-INF
│ └── webapp
└── WEB-INF
│ ├── classes
│ │ ├── com
│ │ │ └── company
│ │ └── shared
│ │ ├── main
│ │ │ ├── java
│ │ │ └── resources
│ │ └── META-INF
│ └── lib
│ └── lib
├── META-INF
└── test
└── java
(All modules.gwt.xml files are at the same level of client/ server/ and shared/ folders.(
From Eclipse, I can create a launcher to compile my project with all the params that I have specified in my POM file but I can't automatically execute the war explode and copy process (this is the main reason for build the project from Maven).
Can I solve that compilation process with my project structure?
Con I use the GWT Eclipse project and Maven together?
Thanks!
You need to use one execution per module to compile.
That being said, you really should split your project into (at least) 5 Maven submodules (one for the server-side code, and on per GWT module, and possibly additional ones for shared code; and you could use the gwt-app and gwt-lib packagings for the GWT modules to simplify your POM files)
I'm building a blog using jekyll and hosting it on github with gh-pages. The root of my project can be see seen below:
├── LICENSE
├── README.md
├── _config.yml
├── _img
│ ├── 2016-09-09\ 14.48.20.png
│ └── 2016-09-09\ 15.25.09.png
.
.
.
├── _posts
│ ├── 2016-09-08-seven-weeks-before-applying-to-devops-job.markdown
│ └── 2016-09-09-an-hour-with-ansible.md
.
.
.
├── _site
│ ├── 2016
│ │ └── 09
│ │ ├── 08
│ │ │ └── seven-weeks-before-applying-to-devops-job.html
│ │ └── 09
│ │ └── an-hour-with-ansible.html
│ ├── LICENSE
│ ├── README.md
│ ├── about
│ │ └── index.html
│ ├── css
│ │ └── main.css
│ ├── feed.xml
│ └── index.html
├── about.md
├── css
│ └── main.scss
├── feed.xml
└── index.html
The documentation gives the following example:
Because of Jekyll’s flexibility, there are many solutions to how to do this. One common solution is to create a folder in the root of the project directory called something like assets or downloads, into which any images, downloads or other resources are placed. Then, from within any post, they can be linked to using the site’s root as the path for the asset to include. Again, this will depend on the way your site’s (sub)domain and path are configured, but here are some examples (in Markdown) of how you could do this using the site.url variable in a post.
Including an image asset in a post:
... which is shown in the screenshot below:
![My helpful screenshot]({{ site.url }}/assets/screenshot.jpg)
I've tried several different ways but non are working once I push gh-pages up:
![]({{ site.github.url }}/_img/2016-09-09 14.48.20.png)
![]({{ site.url }}/_img/2016-09-09 15.25.09.png)
I've also tried "keeping" the _img directory by putting the following in my _config.yaml
# Build settings
markdown: kramdown
keep_files: ["_img"]
But this also is not working. So how do I include images in a jeykll project hosted on github?
Thanks for your help :)
Every folder beginning with an underscore won't be copied to the build destination. The most common way is to store images is to add them to a assets/img folder.
If you want to use _img you have to add to your _config.yml:
include:
- "_img"
Create a folder for your images, you can name it according to your wish (mine is "images")
Find the image address of that image that you want to include in your post
(You can do that by going to your folder image and right click on your image, then copy image address)
Now you use that address in your post without any problem.
I'm new to both Scala and IntelliJ. I've installed Scala plugin for IntelliJ
I've installed Scala in my Ubuntu system with
sudo apt-get install scala
When I try to create new scala project, I'm required to do Scala Settings.
But the problem is I couldn't find the the home directory for my Scala installation.
What is the home directory for Scala in my ubuntu?
Thanks.
The plugin wants to know where the Scala libraries are installed (as it would want to know where the Java SDK is located for a Java module). Note that for different Scala projects you might use different versions of Scala: 2.9.0 or 2.10.2, etc. The dialog offers to download them or you can go to the Scala site and download them yourself. For example, I downloaded scala-2.10.2.tgz from http://www.scala-lang.org/download/ and expanded it in /home/glenn/Applications/Scala/ to
/home/glenn/Applications/Scala/scala-2.10.2/. This latter path is what goes in the "Set Scala Home" field in the dialog.
Note that in my case this is preferable to using the apt-get installation of Scala because the API changes so much that I usually end up with different versions of Scala for different projects that I experiment with.
Follow the version links at http://www.scala-lang.org/download/all.html to the version page with the download for the docs.
Note that for me, IDEA wanted the docs to be in the "doc/scala-devel-docs" directory, whereas the downloaded docs decompressed to "scala-docs-2.10.2". I made a link so that IDEA can find them. My 2.10.2 directory looks like this, now.
scala-2.10.2
├── bin
├── doc
│ ├── scala-devel-docs -> scala-docs-2.10.2
│ ├── scaladoc
│ │ └── lib
│ ├── scala-docs-2.10.2
│ │ └── api
│ └── tools
│ ├── css
│ └── images
├── examples
│ ├── actors
│ ├── monads
│ ├── parsing
│ │ └── lambda
│ ├── tcpoly
│ │ └── monads
│ └── xml
│ └── phonebook
├── lib
├── man
│ └── man1
├── misc
│ └── scala-devel
│ └── plugins
└── src
Run
$ dpkg -L scala
It will show a list of files in that package. Search for scalac:
$ dpkg -L scala | grep scalac
It will be something like /usr/share/scala/bin/scalac. Strip off /bin/scalac part and you will get Scala home: /usr/share/scala.
Update
It seems that there is no dedicated Scala home in Ubuntu. scala-library package files are installed simply to /usr/share/java. I guess then that the most simple way to get proper Scala home is to download a tarball from http://scala-lang.org/, extract it somewhere and use extracted directory as Scala home.
I want to ignore a specific folder (named generated-sources) from my checkstyle reports, because they are generated.
I'm using eclipse-cs for displaying my violations.
i added a suppressionfilter to my xml:
<module name="SuppressionFilter">
<property name="file" value=".\suppressions.xml"/>
</module>
my suppressions.xml looks like this:
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files="\*generated-sources\*\*\.\*" checks="[a-zA-Z0-9]*"/>
</suppressions>
but it is not working. any ideas?
<suppress files="[\\/]generated-sources[\\/]" checks="[a-zA-Z0-9]*"/>
this works :)
Additionally to the answer from Philipp, I had to use an absolute pathname ( :-( ) for the suppression file:
<module name="SuppressionFilter">
<property name="file" value="/Users/xxx/workspace/suppressions.xml"/>
</module>
Looks like the Checkstyle plugin is not using the project home directory.
(at least under eclipse luna / Mac OS X)
As pointed by Thomas Welsch in his answer, there appears to be a problem with using relative pathname for the suppression xml file.
For gradle builds, This gist suggests a workaround:
in build.gradle:
checkstyle {
// use one common config file for all subprojects
configFile = project(':').file('config/checkstyle/checkstyle.xml')
configProperties = [ "suppressionFile" : project(':').file('config/checkstyle/suppressions.xml')]
}
in checkstyle.xml:
<module name="SuppressionFilter">
<property name="file" value="${suppressionFile}" default="suppressions.xml"/>
</module>
(the default value allows IDE plugins, that do not have the gradle variable sorted out, to work correctly)
This answer tries to fill in missing details in the previous answers.
Suppose I have the following maven project, which only lists the directories inside the project.
.
├── pom.xml
└── src
├── main
│ ├── java
│ │ └── edu
│ │ └── utexas
│ │ └── cs
│ │ ├── liveoak
│ │ │ ├── common
│ │ │ ├── tree
│ │ │ └── zero
│ │ ├── logging
│ │ └── sam
│ │ ├── core
│ │ │ └── instructions
│ │ ├── io
│ │ ├── ui
│ │ │ └── components
│ │ └── utils
│ └── resources
│ ├── sam-checks.xml
│ └── sam-suppressions.xml
└── test
sam-checks.xml is the checkstyle configuration file and sam-suppressions.xml is the suppression xml document. Inside sam-checks.xml, I have
<module name="SuppressionFilter">
<property name="file" value="src/main/resources/sam-suppressions.xml"/>
<property name="optional" value="false"/>
</module>
Note the location of sam-suppressions.xml is relative to the pom.xml of the project.
I want to suppress the checks for all the java files under sam directory (main/java/edu/utexas/cs/sam). To do so, my sam-suppressions.xml looks like below
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress checks="[a-zA-Z0-9]*"
files="[\\/]sam[\\/]"/>
</suppressions>
I verify my setup with mvn checkstyle:check. Everything should work.
For me using SuppressionFilter didn't worked at all. But this works, exactly for the purpose of excluding folder from scanning
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value=".*[\\/]folder-name-here[\\/].*$"/>
</module>
Needs to be inserted inside <module name="Checker"> section.
Docs https://checkstyle.sourceforge.io/config_filefilters.html
I'm creating a new Spring MVC webapp.
I used STS 3.0 Dashboard -> Spring Template Project -> Spring MVC Project (URL:http://dist.springsource.com/release/STS/help/org.springframework.templates.mvc-3.1.2.zip) to create the project. It created a directory structure like this:
build/
classes/
src/
main/
java/
com/
example/
web/
HomeController.java
resources/
META-INF/
log4j.xml
webapp/
resources/
WEB-INF/
classes/
spring/
appServlet/
servlet-context.xml
root-context.xml
views/
home.jsp
web.xml
test/ ***(I'll leave out what's under test)***
target/
classes/ ***(I'll leave out what's under classes)***
test-classes/ ***(I'll leave out what's under testclasses)***
WebContent/
META-INF/
MANIFEST.MF
WEB-INF/
lib/
This does not match any directory layout I can find documentation for and it certainly looks wrong. Like why is there a WebContent/WEB-INF as well as a src/webapp/WEB-INF? Why both a build/ and a target/ ?
I want to be able to build and deploy automatically from Eclipse Juno as well as from the command line using Maven, so question 1 is: how do I clean up this directory structure?
Question 2: what is the difference between src/main/resources/ and src/main/webapp/resources? How do I choose which directory to put a given static resource in?
Question 3: If I have libraries that I need to include that I cannot have Maven get, where do I put them?
I tied it in my local and following is the folder structure:
.
├── pom.xml
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── test
│ │ │ └── spring
│ │ │ └── HomeController.java
│ │ ├── resources
│ │ │ ├── log4j.xml
│ │ │ └── META-INF
│ │ └── webapp
│ │ ├── resources
│ │ └── WEB-INF
│ │ ├── classes
│ │ ├── spring
│ │ │ ├── appServlet
│ │ │ │ └── servlet-context.xml
│ │ │ └── root-context.xml
│ │ ├── views
│ │ │ └── home.jsp
│ │ └── web.xml
│ └── test
│ ├── java
│ │ └── com
│ │ └── test
│ │ └── spring
│ └── resources
│ └── log4j.xml
└── target
├── classes
│ ├── com
│ │ └── test
│ │ └── spring
│ │ └── HomeController.class
│ └── log4j.xml
├── m2e-wtp
│ └── web-resources
│ └── META-INF
│ ├── MANIFEST.MF
│ └── maven
│ └── com.exigen
│ └── spring
│ ├── pom.properties
│ └── pom.xml
└── test-classes
├── com
│ └── test
│ └── spring
└── log4j.xml
(I removed the .XXX files/folder which just the metadata for eclipse)
Basically, for you question:
Typical src/webapp/WEB-INF is the maven way and WebContent/WEB-INF is the WTP way. And the maven way is suggested.
Also build/ is generate by eclipse and target/ is the maven way, you can just ignore this.
for Question2, src/mian/resources is the maven way which will be compiled to the target/classes folder. and 'src/main/webapp/resources' is used for some static resources.
for Question3, actually all the 3rd-party libraries are house in the WEB-INF/lib after package, so you can put your libraries into this folder, no matter using maven or not.