Hey guy's I'm posting this question having spent a good deal of time researching and not found a detailed answer. Currently I'm having an issue with generating sources from AWS Workflow. I'm using Maven apt-maven-plugin and aspectj-maven-plugin. These plugins both work for generating the client classes for the activities yet fail with the following error when running mvn clean package or mvn clean install against my workflow classes.
Error
[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-
plugin:1.7:compile (default) on project (myproject): Execution default
of goal org.codehaus.mojo:aspectj-maven-plugin:1.7:compile failed:
basedir (myproject)\target\generated-sources\annotations does not exist
-> [Help 1]
Plugins
<groupId>org.codehaus.mojo</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.0-alpha-5</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.7</version>
<configuration>
<aspectLibraries>
<aspectLibrary>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-flow-build-tools</artifactId>
</aspectLibrary>
</aspectLibraries>
<complianceLevel>1.7</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
<verbose>true</verbose>
<sources>
<source>
<basedir>${basedir}/target/generated-sources/annotations</basedir>
</source>
<source>
<basedir>src/main/java</basedir>
<includes>
<include>**/*.java</include>
</includes>
</source>
</sources>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
I'm not sure how to go about fixing this issue and any help would be great.
The error message is clear- mvn could not find /target/generated-sources/annotations, but in pom it is stated as the source for aspectj-maven-plugin.
Does your code intend to generate sources under /target/generated-sources/annotations? If yes, then there is issue with generation, you'll need to expose more of your pom for me to tell what went wrong. If no, why not remove this part and give it another shot.
<source>
<basedir>${basedir}/target/generated-sources/annotations</basedir>
</source>
ps: I'd rather put this as comment but I'm not able to :(
Related
Im using maven 3.8.3. Tryig to avoid the step of the default jar creation, using the answers I found in topics like:
remove jar created by default in maven
What is the best way to avoid maven-jar?
What I tried:
1.
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.3</version>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.3</version>
<executions>
<execution>
<id>default-jar</id>
<phase/>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
<configuration>
<finalName>unwanted</finalName>
<classifier>unwanted</classifier>
</configuration>
</execution>
</executions>
</plugin>
I also checked the solution of <packaging>pom</packaging> instead of jar. but I'm not sure this is the use case.
More details: This is a non-empty module, containing resources and generated unversioned java sources.
Solutins #1-#3 caused me the following error:
The packaging for this project did not assign a file to the build artifact.
Please assist, Thanks in advance.
I am using the mojohaus jaxb2-maven-plugin to generate Java sources out of xsd schema files. My pom.xml looks like this:
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.5.0</version>
<executions>
<execution>
<id>xjc-1</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<packageName>my.first.package.types</packageName>
<sources>
<source>src/main/java/META-INF/wsdl/firstSchema.xsd</source>
</sources>
</configuration>
</execution>
<execution>
<id>xjc-2</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<packageName>my.second.package.types</packageName>
<sources>
<source>src/main/java/META-INF/wsdl/secondSchema.xsd</source>
</sources>
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
</executions>
<configuration>
<outputDirectory>src/main/javagen</outputDirectory>
</configuration>
</plugin>
This plugin configuration should correspond to the one found here.
When I run the build, the generated source files from the first schema are also put into the second package. Can anyone explain to me why this is the case? Is that a bug or am I missing something?
Thanks a lot for any input!
Edit:
I tried the maven-jaxb2-plugin as well. Same result! So this seems to be a generell maven issue. My plugin configuration for the maven-jaxb2-plugin is as follows:
...
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<executions>
<execution>
<id>first</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaIncludes>
<include>firstSchema.xsd</include>
</schemaIncludes>
<generatePackage>my.first.package.types</generatePackage>
</configuration>
</execution>
<execution>
<id>second</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaIncludes>
<include>secondSchema.xsd</include>
</schemaIncludes>
<generatePackage>my.second.package.types</generatePackage>
</configuration>
</execution>
</executions>
<configuration>
<schemaDirectory>src/main/java/META-INF/wsdl</schemaDirectory>
<generateDirectory>src/main/javagen</generateDirectory>
</configuration>
</plugin>
Does anyone have any ideas? This is starting to annoy me somewhat...
Edit:
I found out that this has to do with the fact that some xsd files have imported files like so:
<xs:import namespace="http://referenced/namespace"
schemaLocation="referencedSchema.xsd" />
Seems to me like Maven is ignoring the namespace tag. How can I tell Maven to stop doing that?
I can answer my own question from a very, very long time ago. The problem was that we also used the maven jaxws plugin to generate web services from wsdl files. Both plugins actually take the underlying xsf files and generate the data structure classes to the respective packages. So the solution is to remove the jaxb plugin from the pom. All xsds get only generated once.
I need to export property values from mvn command line to a file which is needed for my java code later. But i always get the error:
[ERROR] Failed to execute goal
org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:write-project-properties
(default-cli) on project MyApplication: The parameters 'outputFile'
for goal
org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:write-project-properties
are missing or invalid -> [Help 1] [ERROR]
Here is my project structure
MyApplication
|src/main/java
|src/main/resources
|src/test/java
|src/test/resources
|lib ////(no files here yet)
|pom.xml
And my pom.xml is:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>write-project-properties</goal>
</goals>
<configuration><outputFile>${basedir}/lib/build.properties</outputFile>
</configuration>
</execution>
</executions>
</plugin>
Note: I tried by manually creating empty file build.properties in lib folder and even same error. Tried with plugin version 1.0.0 too.
OK, after hours of trying different combinations, (moved <configuration> above/out of <executions>)in pom.xml, i see now lib/build.properties file created. But can someone explain this please?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<configuration>
<outputFile>${basedir}/lib/build.properties</outputFile>
</configuration>
<executions>
<execution>
<id>write-project-properties</id>
<goals>
<goal>write-project-properties</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
I have a question concerning the maven javadoc plugin? I have configured that plugin with this values:
<build>
....
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<configuration>
<noqualifier>all</noqualifier>
<reportOutputDirectory>${basedir}/MyDoc/javadoc</reportOutputDirectory>
<destDir>javadoc</destDir>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
</plugin>
...
</build>
Is there a way to create some kind of documentation, if I use the command mvn clean install? I donĀ“t want to create a Jar File with my JavaDoc documentation, I need a way to create the JavaDoc and put the created source file directly in my maven project.
Thanks !
Greetz
Marwief
To execute plugin during certain phase, add <phase> to <execution>. Plugin should be fired:
<executions>
<execution>
<id>attach-javadocs</id>
<phase>install</phase> <------ HERE
<goals>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
More on maven lifecycle here
I've created custom plugin (http://search.maven.org/remotecontent?filepath=sk/lukasvasek/project-version-dategenerator-mvn/0.0.001/project-version-dategenerator-mvn-0.0.001.pom). When I install it locally (mvn install) i can use goal dateversionoverrider withou problem. Hovewer when I download this plugin from maven central repo I'm getting error:
[ERROR] Could not find goal 'dateversionoverrider' in plugin sk.lukasvasek:project-version-dategenerator-mvn:0.0.001 among available goals
what am I missing?
Thanks in advance
ok so problem was in descriptor, so I changed it to code below and it works.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<configuration>
<goalPrefix>project-version-dategenerator</goalPrefix>
</configuration>
<executions>
<execution>
<id>default-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
<phase>process-classes</phase>
</execution>
<execution>
<id>help-descriptor</id>
<goals>
<goal>helpmojo</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>